Simple question for all of you python gurus

Jeremy Sanders jeremy+plusnews at jeremysanders.net
Fri Feb 27 11:23:57 CET 2004


On Thu, 26 Feb 2004 23:14:33 +0000, Cameron Laird wrote:

>   os.chdir("/home/%s/.tmda/pending" % userid)
>   li = os.popen(...

Wouldn't something like this also work?

li = os.popen('/bin/sh -c "cd /home/%s; /usr/bin/grep -i %s blah"')

This has the advantage that the current directory of the Python program
doesn't change.

Jeremy




More information about the Python-list mailing list