string to list? possible?

Ewald ehoute at zeelandnet_dot_nl
Mon Jan 21 06:17:53 EST 2002

Piet van Oostrum <piet at> wrote in news:wzvgdwyrhb.fsf at

>>>>>> Ewald <ehoute at zeelandnet_dot_nl> (E) writes:
> E> Or less ugly:
> E> a = '[1,2,3,4]'
> E> map(int,filter(lambda x:x.isdigit(),a))
> Now try this with a = '[11,12,13,1234]'

Well i guess i didn't test it enough. But
[int(x) for x in a[1:-1].split(',')]
should be ok, but will only work for integers (<=sys.maxint) inside the 

More information about the Python-list mailing list