[Tutor] Split string and convert to int

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Oct 30 03:43:36 EST 2003


> fooDate='10/3/2003'
> 
> month, day, year = fooDate.split('/')
> month=int(month)
> day=int(day)
> year=int(year)

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

But your method isn't that bad IMHO.

Alan G.



More information about the Tutor mailing list