[Newbie]Trouble with string method
nathanjohns77 at hotmail.com
Thu Mar 25 23:42:04 CET 2004
I'm attempting to open a file, read the lines, sort them, change any
uppercase character to lowercase, and output to another file:
unsorted = open('unsorted', 'r')
L = unsorted.readlines()
L = L.lower()
sorted = open('sorted', 'w')
when trying to run, I get this traceback:
Traceback (most recent call last):
File "sort_list.py", line 6, in ?
L = L.lower(L)
AttributeError: 'list' object has no attribute 'lower'
Do I need to somehow convert the list into strings?
Thanks for any help!
More information about the Python-list