Python - split string and return int -
x='2013:02:01' y,m,d=x.split(':')
produces y,m,d strings. how produce them ints using 1 line
failed:
y,m,d=int(y.split(':')) y,m,d=int(y),int(m),int(d)=y.split(':')
y, m, d = map(int, x.split(':'))
map
applies function each of elements in iterable. in case apply int
each of values returned split
, give result.
Comments
Post a Comment