On Thu, 28 Jul 2011 17:48:34 +0200, Web Dreamer wrote: >> I would like to parse this TCL command line with shlex: >> >> '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG'
>>>> s = s.replace('[','"[') >>>> s = s.replace(']',']"') Note that this approach won't work if you have nested brackets or braces. That would require a real parser. -- http://mail.python.org/mailman/listinfo/python-list