The following works in the interactive window of PythonWin, but fails in
a script. TypeError: Objects of type 'slice' can not be converted to a
COM VARIANT
I just need to parse out these dates, but it's making me crazy.
Shouldn't it work in both the interactive window and a script?
[color=blue][color=green][color=darkred]
>>> d = "5-18-05 to 5-31-05"
>>> print d[0:d.find("to")-1][/color][/color][/color]
5-18-05[color=blue][color=green][color=darkred]
>>> print d[d.find("to")+3:][/color][/color][/color]
5-31-05[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Kev
a script. TypeError: Objects of type 'slice' can not be converted to a
COM VARIANT
I just need to parse out these dates, but it's making me crazy.
Shouldn't it work in both the interactive window and a script?
[color=blue][color=green][color=darkred]
>>> d = "5-18-05 to 5-31-05"
>>> print d[0:d.find("to")-1][/color][/color][/color]
5-18-05[color=blue][color=green][color=darkred]
>>> print d[d.find("to")+3:][/color][/color][/color]
5-31-05[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Kev
Comment