[IPython-dev] Re: [IPython-user] pysh is in CVS
Ville Vainio
vivainio at kolumbus.fi
Mon Jun 28 19:51:33 EDT 2004
> get rid of it (plus, it's expensive as you noted). If anyone can
> provide me with a pure python function which does:
>
> argv_list = parse_string(argv_str)
>
> which takes a string (with arbitrary quotes, parens, etc.) and returns
> a python list which would be the correct sys.argv seen by a command
> line consisting of this argv_str, I'd be very happy.
Well, shlex.split(s) does arbitrary quotes, but not parens:
In [5]: shlex.split('hi "very much stuff" (a b c) hai')
Out[5]: ['hi', 'very much stuff', '(a', 'b', 'c)', 'hai']
Still, it's an ok solution for most cases, dont you think?
More information about the IPython-dev
mailing list