Sent from my iPhone
Begin forwarded message: From: Derek Smith <[email protected]<mailto:[email protected]>> Date: January 19, 2018 at 4:01:58 PM EST To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: print a for loop system call Why does A work but B does not? #!/usr/bin/env python3 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 ## # print ( dev.strip().split().decode()[0] ) ## B ## And if I try to store in an array using rmts = [ dev.strip().split()[0].decode() ] it only stores the last line when there are over 100 lines. Sample line looks like rmt144 Available 04-T1-01 LTO Ultrium Tape Drive (FCP) thank you! Derek Smith | Unix/TSM Administrator | Racksquared Data Centers ': 614-437-4983 * 325 East Spring Street, Columbus, OH 43215 :: [email protected]<mailto:[email protected]> *: www.racksquared.com<http://www.racksquared.com/> | www.racksquared.jobs<http://www.racksquared.jobs/> [cid:[email protected]] _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
