create lowercase strings in lists - was: (No subject)
Peter Otten
__peter__ at web.de
Fri Dec 17 05:40:07 EST 2004
Mark Devine wrote:
> I got the script working. Thanks for all your help everyone. Trouble is
> its not showing the correct results. Here is the script and results:
In my book it is not working then.
> def normalize(text, unwanted = "()", table =
> string.maketrans(string.ascii_uppercase,string.ascii_lowercase)):
> text.translate(table,unwanted)
Strings are immutable in Python. Make that
text = text.translate(table, unwanted)
This line of the script's output could have given you a clue:
> [Set(['a', 'C', 'b', '(D)']), Set(['A', 'B', 'D']), Set(['A', 'B', 'E'])]
(I didn't look any further, so there may be other problems)
Peter
PS: Do us a favour and (a) don't top-post (b) use space not tabs in your
source code (c) remove all text quoted from the parent that is not relevant
to your current problem.
More information about the Python-list
mailing list