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 now references "string with foo string with baz"), but it doesn't feel right. Is there a more pythonic way to interpret strings according to shell rules for word expansion? Relying on commands feels like a kludge, and shlex is way too much work for this (not to mention that it doesn't really address the issue). -- http://mail.python.org/mailman/listinfo/python-list