In article <[EMAIL PROTECTED]>, Peter Otten <[EMAIL PROTECTED]> wrote: >Terry Reedy wrote: >> >>> 'abcde'.translate(str.maketrans('','','bcd')) >> 'ae' >You should mention that you are using Python 3.0 ;) >The 2.5 equivalent would be > >>>> u"abcde".translate(dict.fromkeys(map(ord, u"bcd"))) >u'ae'
Only if you're using Unicode: >>> 'abcde'.translate(string.maketrans('',''), 'bcd') 'ae' >>> sys.version_info (2, 4, 4, 'final', 0) -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ "Frankly I have no feelings towards penguins one way or the other" -- Arthur C. Clarke her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- http://mail.python.org/mailman/listinfo/python-list