OS specific command in Python

3c273 nospam at nospam.com
Wed Jun 21 18:41:50 EDT 2006


"Avell Diroll" <avelldiroll at yahoo.fr> wrote in message
news:4499ad49$0$23551$626a54ce at news.free.fr...
> 3c273 wrote:
> > I was just trying to learn how to use .communicate() and all of the
examples
> > I see have [0] after .communicate(). What is the significance of the
[0]?
>
>
>  From the Python Library Reference
> (http://docs.python.org/lib/node239.html), you learn that the method
> communicate() from the subprocess.Popen() class returns a tuple
> containing the standard output as first item and the standard error of
> the child process as second item. So the [0] in the example is for
> selecting the first item of the tuple ...

Thank you for taking the time to make that clear for me. I did read the
docs, I just didn't really understand what communicate() did, but I do now.
Thanks again.
Louis





More information about the Python-list mailing list