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

Fredrik Lundh fredrik at pythonware.com
Fri Dec 15 01:36:15 EST 2006


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 "target lists" in Python)

</F>




More information about the Python-list mailing list