[Tutor] Fwd: print a for loop system call

2018-01-20 Thread Derek Smith
Sent from my iPhone Begin forwarded message: From: Derek Smith mailto:dereksm...@racksquared.com>> Date: January 19, 2018 at 4:01:58 PM EST To: "tutor-requ...@python.org" mailto:tutor-requ...@python.org>> Subject: print a for loop system call Why does A work

Re: [Tutor] Fwd: print a for loop system call

2018-01-20 Thread Alan Gauld via Tutor
On 20/01/18 18:26, Derek Smith wrote: > import os > import sys > from subprocess import Popen, PIPE > > pipe = Popen('lsdev -c tape', shell=True, stdout=PIPE) > > for dev in pipe.stdout : > print ( dev.strip().split()[0].decode() )## A ## This is OK > # print ( dev.strip().split().