Piping stdout to Python callable

Edward Diener eldiener at earthlink.net
Mon Aug 16 20:04:23 EDT 2004


>From within a function in my own module I need to take the output from a
Python module "A", which is sending data to stdout and which can not be
changed and which I need to invoke as a top-level module, and pipe it into
another function in my own module so that I can read it from stdin. Is there
an easy way to do this ? The only way I can presently think to do this is
through "system python A.py | python MyOwnModule.py", which seems a bit
laborious having to invoke python.exe itself twice. Any other solution would
be most welcome.





More information about the Python-list mailing list