Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16419

Re: How convert a list string to a real list

References <CAHbqn4jog2CzT+ahL3XwPZwvAr8eKN3qHsp2yaJk1VYa1157JQ@mail.gmail.com>
Date 2011-11-30 17:24 +1100
Subject Re: How convert a list string to a real list
From Alec Taylor <alec.taylor6@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3144.1322634302.27778.python-list@python.org> (permalink)

Show all headers | View raw


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@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
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How convert a list string to a real list Alec Taylor <alec.taylor6@gmail.com> - 2011-11-30 17:24 +1100

csiph-web