On Thu, Feb 26, 2009 at 2:00 AM, <kkwai...@umich.edu> wrote: > Hi, > > I am trying to convert an output from subprocess.Popen() from a byte string > to a list of numbers. This is what Popen returns: > > print SAL.stdout.readlines() > > ['[335, 180, 201, 241, 199]\r\n']
For one line: In [11]: s = '[335, 180, 201, 241, 199]\r\n' In [12]: map(int, s.strip('[]\r\n').split(', ')) Out[12]: [335, 180, 201, 241, 199] Modify appropriately to handle a list of lines. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor