On 11/30/11 16:48, Hidura wrote:
Why you don't make this "['1','2','3']".strip("[]").split(',') work for me

because it breaks on things like

  s = """
[[1,2,3],42,'''triple the fun!''', "can't touch this, eh?",r'"Back\\\slashes?!", she said.', [4,5,6]]
    """

Commas can be embedded in strings, strings can be delimited with single, double, or triple quotes, raw strings can be used, more than one opening or closing "["/"]" can appear in a row, leading or trailing whitespace might throw you off...using ast.literal_eval() should just Do the Right Thing™.

-tkc


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to