[Tutor] Iteration issues

Peter Otten __peter__ at web.de
Sat May 12 03:40:15 EDT 2018


Neil Cerutti wrote:

> punctuation_removal_table = str.maketrans({c: None for c in
> string.punctuation})

Alternative spellings:

>>> from string import punctuation
>>> (str.maketrans({c: None for c in punctuation})
...  == str.maketrans(dict.fromkeys(punctuation))
...  == str.maketrans("", "", punctuation))
True




More information about the Tutor mailing list