【发布时间】:2014-01-09 09:34:46
【问题描述】:
如果我有一个像examle/def/5/ 这样的url,我尝试通过使用从url 中找到int 值
re.findall([0-9],'examle/def/5/')
但我得到一个错误。
Traceback(最近一次调用最后一次):文件“”,第 1 行,in 文件“/usr/lib/python2.7/re.py”,第 177 行,在 findall 中返回 _compile(pattern, flags).findall(string) File "/usr/lib/python2.7/re.py", line 229, in _compile p = _cache.get(cachekey) TypeError: unhashable type: 'list'
我该怎么做?
【问题讨论】:
-
什么错误?请分享回溯。
-
回溯(最近一次调用最后):文件“
”,第 1 行,在 文件“/usr/lib/python2.7/re.py”,第 177 行,在findall return _compile(pattern, flags).findall(string) File "/usr/lib/python2.7/re.py", line 229, in _compile p = _cache.get(cachekey) TypeError: unhashable type: 'list' -
请使用回溯更新您的问题,而不是放在评论中。
标签: python regex python-2.7