[EMAIL PROTECTED] wrote: > In cmd, I can use find like this. > > C:\>netstat -an | find "445" > TCP 0.0.0.0:445 0.0.0.0:0 LISTENING > UDP 0.0.0.0:445 *:* > > C:\> > > And os.system is OK. >>>> import os >>>> os.system('netstat -an | find "445"') > TCP 0.0.0.0:445 0.0.0.0:0 LISTENING > UDP 0.0.0.0:445 *:* > 0 >>>> > > But I don't know how to use subprocess.Popen to do this.
While there certainly are valid usecases for piping with subprocess in Python - this ain't one I'd say. Just read the output of netstat yourself, and filter for lines that contain the desired pattern. Diez -- http://mail.python.org/mailman/listinfo/python-list