Re: WHAT is [0] in subprocess.Popen(blah).communicate()[0]

2006-12-14 Thread Fredrik Lundh
Gabriel Genellina wrote: >> I like using pattern matching in these simple cases: >> >> last_line, _ = subprocess.Popen([r"tail","-n 1", "x.txt"], >> stdout=subprocess.PIPE).communicate() > > pattern matching??? http://www.haskell.org/tutorial/patterns.html (the syntax's called "tar

Re: WHAT is [0] in subprocess.Popen(blah).communicate()[0]

2006-12-14 Thread Gabriel Genellina
At Thursday 14/12/2006 15:30, Neil Cerutti wrote: I like using pattern matching in these simple cases: last_line, _ = subprocess.Popen([r"tail","-n 1", "x.txt"], stdout=subprocess.PIPE).communicate() pattern matching??? -- Gabriel Genellina Softlab SRL ___

Re: WHAT is [0] in subprocess.Popen(blah).communicate()[0]

2006-12-14 Thread Neil Cerutti
On 2006-12-14, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > johnny wrote: > >> Can someone tell me what is the reason "[0]" appears after >> ".communicate()" >> >> For example: >> last_line=subprocess.Popen([r"tail","-n 1", "x.txt"], >> stdout=subprocess.PIPE).communicate()[0] > > as explained in th

Re: WHAT is [0] in subprocess.Popen(blah).communicate()[0]

2006-12-14 Thread Fredrik Lundh
johnny wrote: > Can someone tell me what is the reason "[0]" appears after > ".communicate()" > > For example: > last_line=subprocess.Popen([r"tail","-n 1", "x.txt"], > stdout=subprocess.PIPE).communicate()[0] as explained in the documentation, communication() returns two values, as a tuple. [

WHAT is [0] in subprocess.Popen(blah).communicate()[0]

2006-12-14 Thread johnny
Can someone tell me what is the reason "[0]" appears after ".communicate()" For example: last_line=subprocess.Popen([r"tail","-n 1", "x.txt"], stdout=subprocess.PIPE).communicate()[0] Thank you. -- http://mail.python.org/mailman/listinfo/python-list