这是一个创建于 4144 天前的主题,其中的信息可能已经有所发展或是发生改变。
在循环里进行正则表达式匹配的时候,经常出现没有理由的匹配失败,例如
try
match = re.match(str)[1] # TypeError: Cannot read property '1' of null
catch error
match = re.match(str)[1] # 完全正常
求解
2 条回复 • 1970-01-01 08:00:00 +08:00
![bitsmix](https://cdn.v2ex.com/avatar/978f/ce5b/2591_normal.png?m=1458402638) |
|
1
bitsmix 2013-02-09 11:20:56 +08:00 via iPhone
你自己的问题。
|
![wsph123](https://cdn.v2ex.com/avatar/d242/f1a2/16608_normal.png?m=1676732189) |
|
2
wsph123 2013-02-11 17:13:11 +08:00 1
match返回不一定有[1]
|