首页 新闻 赞助 找找看

python正则表达式问题

0
悬赏园豆:5 [已解决问题] 解决于 2017-10-18 11:21

在练习python正则表达式时,为何re.search(str1,str2,re.L)无法使用,我的python版本的是3.6.1,错误应该re.L这个地方,为什么?

咸鱼科比的主页 咸鱼科比 | 初学一级 | 园豆:194
提问于:2017-10-17 17:33
< >
分享
最佳答案
1

Changed in version 3.6: re.LOCALE can be used only with bytes patterns and is not compatible with re.ASCII.

你的str1和str2是字符串吧

import re

str1 = b"aa\ws"
str2 = b"aahssbbbb"

a = re.search(str1,str2,re.L)

这样可以

收获园豆:5
Masako | 小虾三级 |园豆:1893 | 2017-10-18 10:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册