March 2003
Intermediate to advanced
656 pages
39h 30m
English
translate
s.translate(table,deletechars='')Returns a copy of s where all characters
occurring in string deletechars are
removed, and the remaining characters are mapped through
translation-table table. When
s is a plain string,
table must be a plain string of length
256. When s is a Unicode string,
table must be a Unicode string of length
65536. Each character c is mapped to
character
table
[ord(
c
)].
A plain-string table is most often built
using function string.maketrans, covered later.
Read now
Unlock full access