turn list of letters into an array of integers

Peter Otten __peter__ at web.de
Wed Oct 24 03:47:57 EDT 2012


Chris Rebert wrote:

> line.strip().split()

No need to strip() if you are going to split on whitespace:

>>> line = " a b c \n"
>>> line.split() == line.strip().split()
True

Lest the new idiom takes on while you are bravely fighting the immortable 
readlines() ;)




More information about the Python-list mailing list