string, split, sort, None, huh?

Glenn W Jackman glennj at pcard31e.ca.nortel.com
Fri Feb 16 23:55:41 CET 2001


Phlip wrote:
>        print repr(lines)
>        print repr(lines.sort())
>
>Now the output:
>
>        ['Mary', 'had', 'a', 'little', 'lamb']
>        None

sort() sorts the list in place, and returns None.  Try:

lines = ['Mary', 'had', 'a', 'little', 'lamb']
print repr(lines)
lines.sort()
print repr(lines)


-- 
Glenn 



More information about the Python-list mailing list