首页 > 其他分享 >re.findall() 报错:TypeError: expected string or bytes-like object

re.findall() 报错:TypeError: expected string or bytes-like object

时间:2023-02-01 09:25:47浏览次数:43  
标签:TypeError string pattern re 报错 str expected findall

复现:

解决:

import re

pattern_str = '共(.*?)件商品'
result = re.findall(pattern_str, str(b'fsdf'))

总结:
findall,第二个参数只能是字符串

标签:TypeError,string,pattern,re,报错,str,expected,findall
From: https://www.cnblogs.com/czzz/p/17081400.html

相关文章