Hmmm, the following session causes me some concern:
>>> print a
$(which sh) ${HOME/b/k} 'the dog'
>>> print b
/bin/sh /home/kill the dog
>>> shlex.split(a)
['$(which', 'sh)', '${HOME/b/k}', 'the dog']
>>> shlex.split(b)
['/bin/sh', '/home/kill', 'the', 'dog']
I started with a, which contains the
Quick glance at the reference manual, and I think that pipes.Template
may do exactly what I want. Is that what you're referring to?
I realized when I woke up that I have another slight irritant:
I need to be able to intelligently parse a command line. ie
I need to correctly parse each of the fol
"bill" <[EMAIL PROTECTED]> writes:
> Consider the following:
>
> import os, commands
> os.environ['QWE']="string with foo"
> a = '$QWE ${QWE/foo/baz}'
> b = commands.getoutput('echo ' + a)
>
>
> This does what I want, which is to expand
> a according to the standard bash expansion rules
> (so b n
Something in this vein?
>>> baseString = "string with %s"
>>> [ baseString % ss for ss in ('foo', 'baz') ]
['string with foo', 'string with baz']
>>> b = " ".join([ baseString % ss for ss in ('foo', 'baz') ])
>>> b
'string with foo string with baz'
>>>
-- Paul
--
http://mail.python.org/mailman/