Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16462 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2011-11-30 18:12 -0500 |
| Last post | 2011-11-30 18:12 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How convert a list string to a real list Terry Reedy <tjreedy@udel.edu> - 2011-11-30 18:12 -0500
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2011-11-30 18:12 -0500 |
| Subject | Re: How convert a list string to a real list |
| Message-ID | <mailman.3182.1322694757.27778.python-list@python.org> |
On 11/30/2011 5:48 PM, Hidura wrote:
> Why you don't make this "['1','2','3']".strip("[]").split(',') work for me
Look more carefully. This is not the same as ast.literal_eval().
>>> "['1','2','3']".strip("[]").split(',')
["'1'", "'2'", "'3'"] # list of 3-char strings
>>> ast.literal_eval("['1','2','3']")
['1', '2', '3'] # list of 1-char strings
Even if it were the same, it would be specific to lists of strings and
would not work for anything else.
Back to top | Article view | comp.lang.python
csiph-web