python判断字符串是否包含特殊字符

import re
a=["#@$@#$a","asdasd"]
for i in a:
	b=re.search(r"\W", i)
	print(b)

在这里插入图片描述

不存在特殊字符 a的值为:false
存在特殊字符 a 的值为true

猜你喜欢

转载自blog.csdn.net/qq_34237321/article/details/109475995