what would be the regular expression for null byte present in a string
Thomas 'PointedEars' Lahn
PointedEars at web.de
Wed Jan 14 15:11:24 CET 2015
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
>>> 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))
Please do not cc me. / Bitte keine Kopien per E-Mail.
More information about the Python-list