Tags
Python str
instances have many useful methods. I use strip
, split
, startswith
, and others, quite a lot, for instance. One method I haven’t had reason to use so far is translate
. It takes a dictionary argument and uses it to map the existing string to a new string.
It’s flexible and useful, so it’s worth knowing how to use.