Kyle Kwaiser wrote:
x = ['[335, 180, 201, 241, 199]\r\n'] y = map( int, x[0].strip( '[]\r\n' ).split( ', ' ) ) #need an index here print y [335, 180, 201, 241, 199]
I realize it's not totally secure, but if your string really is in that format (i.e., a representation of a list), you COULD just use eval():
>>> x = '[335, 180, 201, 241, 199]\r\n' >>> y = eval(x.strip()) >>> print y [335, 180, 201, 241, 199] >>> Regards, Vern Ceder _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor