[Tutor] Convert a string of numbers to a list

kkwaiser at umich.edu kkwaiser at umich.edu
Thu Feb 26 08:00:37 CET 2009


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']

Except the string will be much longer in practice.

I've experimented with .rstrip and .split and I've looked over the csv  
module but have not been able to figure anything out.   My only  
restriction is to avoid writing to a file.

I have a feeling I'm missing something incredibly simple.  Any help  
would be greatly appreciated,

kbk




More information about the Tutor mailing list