what would be the regular expression for null byte present in a string
Thomas 'PointedEars' Lahn
PointedEars at web.de
Wed Jan 14 14:52:06 CET 2015
Peter Otten wrote:
> Shambhu Rajak wrote:
>> I have a string that I get as an output of a command as:
>> I want to fetch '10232ae8944a' from the above string.
>> 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
filtered = ''.join(filter(lambda ch: ord(ch) > 0x0f, s))
Please do not cc me. / Bitte keine Kopien per E-Mail.
More information about the Python-list