How convert a list string to a real list

Alec Taylor alec.taylor6 at gmail.com
Wed Nov 30 01:24:59 EST 2011


import json

s = json.dumps([1, 2, 3, 4])
# '[1, 2, 3, 4]'
l = json.loads(s)
# [1, 2, 3, 4]

2011/11/30 郭军权 <guojunquan at gmail.com>:
> Good after
>     I have a string  liststr = '["aaaa","bbbb","ccc"]' ,and I need convert
> it to a list like list = ["aaaa","bbbb","ccc"],what can id do?
> Thanks.
>
>
> --
> 郭军权
> 清华大学网络中心网络安全实验室
> guojunquan{at}gmail.com
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list