用两种方式写出一 个正则表达式匹配字符'Python123'中的'Python'并输出字符串Python'。

用两种方式写出一 个正则表达式匹配字符'Python123'中的'Python'并输出字符串Python'。

import re
r1 = r.search("\D+","Python123)
print(r1.group())
r2 = r.match("Python","Python123)
print(r2.group())

print(''.join([i for i in 'Python123' if not i.isdigit()]))
#--------------------------------------------------------------
from string import digits
print('Python123'.translate(None, digits))

import re

s = 'Python123'

res = re.findall(r"(\D+)", s)
print(res)
res = re.findall(r"([a-zA-Z]+)", s)
print(res)