I have a list as :
a=[u'hello',u'well',u'1024']
I want to have it as :
a=[u'hello',u'well',1024]
So please suggest how will i have it.
I have a list as :
a=[u'hello',u'well',u'1024']
I want to have it as :
a=[u'hello',u'well',1024]
So please suggest how will i have it.
Python Map and a conversion function with try catch will do
lst=[u'hello',u'well',u'1024']
def conversion(value):
try:
return int(value)
except Exception:
return value
map(conversion,lst)
[u'hello', u'well', 1024]