Sep-23-2019, 04:17 PM
(This post was last modified: Sep-23-2019, 05:00 PM by Gribouillis.)
The documentation of maketrans() says it all. If there are two arguments to maketrans(), they must be strings of equal length.
In fact you don't need to understand the table returned by maketrans to use it:
In fact you don't need to understand the table returned by maketrans to use it:
>>> table = str.maketrans("abc", "ABC") >>> s = "At dawn, if it was low tide on the flats, I would awaken to the chatter of gulls." >>> s.translate(table) 'At dAwn, if it wAs low tide on the flAts, I would AwAken to the ChAtter of gulls.'