import re a=["#@$@#$a","asdasd"] for i in a: b=re.search(r"\W", i) print(b)
不存在特殊字符 a的值为:false 存在特殊字符 a 的值为true