1

I am trying to use string translate in Python 3 but it does not seem to work. I looked at other answers (1, 2) but up to no avail.

I am using the following code: Can someone please help me?

from string import punctuation
punctuation = dict(list(map(lambda x: [x, None], list(punctuation))))
s = "hello!brother"
s.translate(punctuation)
silent_dev
  • 1,516
  • 2
  • 18
  • 39

0 Answers0