[Tutor] updating Unix config file
alan.gauld at btinternet.com
Tue Oct 20 09:29:59 CEST 2009
"Matt Herzog" <msh at blisses.org> wrote
> Anyway, I'd like a hint as to how I could convert this:
> ifcfg_lines = os.popen("/sbin/ifconfig fxp0").readlines()
> x = string.split(ifcfg_lines)
> to the subprocess module. The os module is going away, right?
The os module is not going away although the popen
function might some day.
However subprocess is currently the recommended way
to do subprocess control and is more powerful and flexible
Did you see the subprocess documentation page that
shows how to do the equivalent of popen etc?
Look down to section 126.96.36.199
Author of the Learn to Program web site
More information about the Tutor