[Tutor] Filtering a String
matthew.williams at cancer.org.uk
Sun Mar 20 23:05:23 CET 2005
I'm trying to filter a file, to get rid of some characters I don't want
I've got the "Python Cookbook", which handily seems to do what I want,
a) doesn't quite and
b) I don't understand it
I'm trying to use the string.maketrans() and string.translate(). From
what I've read (in the book and the Python Docs), I need to make a
translation table, (using maketrans) and then pass the table, plus and
optional set of characters to be deleted, to the translate() function.
#This aiming to delete the % and ):
TypeError: translate expected at most 2 arguments, got 3
Please could someone explain this to me (slowly).
As a measure of my slowness:
This is my first programming language
I couldn't get the tutor list to work for ages - until I realised I was
sending all the desperate pleas for help to tutor-request. Perhaps there
is no hope......
More information about the Tutor