import re
name1 = "a#pple" # 命名正确, a
name2 = "apple!"
ret = re.match("[a-zA-Z_][a-zA-Z0-9_]*", name1)
if ret:
print("命名正确,", ret.group(
笔记 - 正则表达式python:匹配结尾与开头
最新推荐文章于 2024-04-23 12:21:55 发布
import re
name1 = "a#pple" # 命名正确, a
name2 = "apple!"
ret = re.match("[a-zA-Z_][a-zA-Z0-9_]*", name1)
if ret:
print("命名正确,", ret.group(