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

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -