string to list? possible?

Gerhard Häring gh_pythonlist at gmx.de
Sun Jan 20 15:00:49 EST 2002


Le 20/01/02 à 19:38, maximilianscherr écrivit:
> i need to convert a string like "[1, 2, 3, 4]" to a list [1, 2, 3, 4].
> possible?

You could use eval() like in:

    l = eval("[1,2,3,4]")

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 6.4 °C      Wind: 4.2 m/s




More information about the Python-list mailing list