Using ascii numbers in regular expression
google at mrabarnett.plus.com
Tue Apr 28 15:49:07 CEST 2009
jorma kala wrote:
> Thanks very much for your reply.
> What I mean is that I would like to use the ascii number in a regular
> expression pattern.
> For instance, if I want to substitute the occurrences of character 'a'
> for the character 'b' in a string, instead of doing this:
> I'd like to specify the ascii number of a (which is 97)
> I tried converting 97 to hexadecimal (with hex()) and tried this
> but it doesnt work.
> I need this because I'm working on non printable characters.
You're almost there:
or better yet:
More information about the Python-list