读书人

举一个python re文档的例证

发布时间: 2013-10-14 12:54:46 作者: rapoo

举一个python re文档的例子
Some characters, like '|' or '(', are special. Special characters either stand for classes of ordinary characters, or affect how the regular expressions around them are interpreted. Regular expression pattern strings may not contain null bytes, but can specify the null byte using the \number notation, e.g., '\x00'.

谁能写两个例子出来表达下上面的意思呀?特别是最后一句话。另外特殊字符需要转义这个知道,\x00不懂。
[解决办法]


>>> s='\x00'+r'\\'
>>> re.findall(r'[\x00\x5c]',s)
['\x00', '\\', '\\']

读书人网 >perl python

热点推荐