Message169988
| Author |
r.david.murray |
| Recipients |
ZhuangZi, bethard, r.david.murray |
| Date |
2012年09月07日.16:23:53 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1347035034.57.0.292615354316.issue15874@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年09月07日 16:23:54 | r.david.murray | set | recipients:
+ r.david.murray, bethard, ZhuangZi |
| 2012年09月07日 16:23:54 | r.david.murray | set | messageid: <1347035034.57.0.292615354316.issue15874@psf.upfronthosting.co.za> |
| 2012年09月07日 16:23:54 | r.david.murray | link | issue15874 messages |
| 2012年09月07日 16:23:53 | r.david.murray | create |
|