[Tutor] Split string and convert to int

mlong at datalong.com mlong at datalong.com
Wed Oct 29 16:14:06 EST 2003


Hi,

I have a string variable that represents a date. I want to pull out the
individual parts as integers. Is there a more efficient way to do this?

fooDate='10/3/2003'

month, day, year = fooDate.split('/')
month=int(month)
day=int(day)
year=int(year)


Thanks,
Mike



More information about the Tutor mailing list