Thanks! It worked! But why didn't I see functions : translate(), maketrans(), rstrip(), etc. listed when I called print(dir(string))?
On Thursday, April 11, 2013 11:45:05 AM UTC-4, Chris Angelico wrote: > > > import string > > > s = "string. With. Punctuation?" > > > out = s.translate(string.maketrans("",""), string.punctuation) > > > > Try this instead: > > > > import string > > s = "string. With. Punctuation?" > > out = s.translate(str.maketrans("", "", string.punctuation)) > > > > Due to the changes in string handling (s is a Unicode string in Python > > 3, not a string of bytes), str.translate() got changed. Check out > > help(str.maketrans) and help(str.translate) in interactive Python for > > more details. > > > > ChrisA -- http://mail.python.org/mailman/listinfo/python-list