R. David Murray added the comment:
I had forgotten all about os.path.expandvars. Note, however, that that
function is very naive:
>>> os.path.expandvars("'$HOME'")
"'/home/rdmurray'"
That is, it is doing unconditional substitution, not parsing shell syntax. It
should work well for simple cases, though.
It might be worth throwing up a trial balloon on python-ideas for adding
something to shlex that would do a "better" job of environment variable
substitution for the version of shell syntax that shlex supports, which would
therefore become a sort of platform-independent syntax for doing this.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15874>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com