26 Oct
2016
26 Oct
'16
11:54 p.m.
Mikhail V writes:
I need translate() which drops non-defined chars. Please :)
import collections def translate_or_drop(string, table): """ string: a string to process table: a dict as accepted by str.translate """ return string.translate(collections.defaultdict(lambda: None, **table)) All OK now?