"Matt Herzog" <m...@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[3])[1]

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 than popen.

Did you see the subprocess documentation page that shows how to do the equivalent of popen etc? Look down to section 18.1.3.5

http://docs.python.org/library/subprocess.html#module-subprocess

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to