faqts : Computers : Programming : Languages : Python : Common Problems : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 2 people (50%) answered Yes
Recently 1 of 2 people (50%) answered Yes

Entry

How do I convert [ 'abc' '4' '4000' 'def'] to ['abc' 4 '4000' 'def']? i.e convert the 4 to integer.

May 12th, 2006 19:34
Reed O'Brien, Vivek Chid,


>>> L = ['abc', '4', 'def']
>>> L[1] = int(L[1])
>>> L
['abc', 4, 'def']