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

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -