string = ‘a2bc3d’
将其分割为['a', '2b', 'c', '3d'],
逻辑为如果出现数字(0~9),
则与其后面的一个字母分在一起。
string中的数字不会出现在末尾。
print(re.findall(r"(\d\w|[a-z][a-z]*(?=\d))", "a2bcx3d"))
# 我的Python3报错,不知是啥原因
string = ‘a2bc3d’
将其分割为['a', '2b', 'c', '3d'],
逻辑为如果出现数字(0~9),
则与其后面的一个字母分在一起。
string中的数字不会出现在末尾。
print(re.findall(r"(\d\w|[a-z][a-z]*(?=\d))", "a2bcx3d"))
# 我的Python3报错,不知是啥原因
print(re.findall(r"(\d\w|[a-z])", "a2bcx3d"))