[docs] str.translate documentation error 3.3.3

bob gailer bgailer at gmail.com
Sun Apr 13 03:49:43 CEST 2014


str.translate(map)
Return a copy of the s where all characters have been mapped through the 
map which must be a dictionary of Unicode ordinals (integers) to Unicode 
ordinals, strings or None.

However map can also be a string or byte string of arbitrary length!

 >>> 'asdf'.translate('qwer')
'asdf'
 >>> 'asdf'.translate(b'qwer')
'asdf'
 >>> 'asdf'.translate('qwer'*100)
'wrqe'
 >>> 'asdf'.translate(b'qwer'*100)
'wrqe'


More information about the docs mailing list