haiii


Do anyone know how to convert array like this into [26 18 20]

because i have to plot graph for these value,

array is not allow me to do that ,i got from database table with data type varchar....problem is i shouldnot change the datatype ....

is there any way............?Please Help me!!!!!

Recommended Answers

All 3 Replies

a = ['1','2','3']
# use map
b = map(lambda x:int(x), a)
# or
b = [ int(x) for x in a ]

Thanks..............

Cleaner map solution as lambda is not needed:

a = map(int, a)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.