笔记 - 正则表达式python:匹配结尾与开头

import re name1 = "a#pple" # 命名正确, a name2 = "apple!" ret = re.match("[a-zA-Z_][a-zA-Z0-9_]*", name1) if ret: print("命名正确,", ret.group()) else: print("命名不正确") 明明命名不合法,为何返回正确,并且只匹配到正确部分pytho
相关文章
相关标签/搜索