Thomas 'PointedEars' Lahn wrote: > Peter Otten wrote: >> Shambhu Rajak wrote: >>> I want to find a re pattern that could replace all the \x01..\x0z to be >>> replace by empty string '', so that I can get the desired portion of >>> string >>> >>> Can anyone help me with a working regex for it. >> >> I think you want the str.tranlate() method rather than a regex. > > Another possibility, but given the length of the list probably not the > most efficient one. Aside from re and this one, here is another (tested > with Python 3.4.2): > > filtered = ''.join(filter(lambda ch: ord(ch) > 0x0f, s))
filtered = ''.join(filter(lambda ch: ch > "\x0f", s)) -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/mailman/listinfo/python-list