python 正则表达式替换字符串中匹配的字符时间:2022-05-02 17:45:50 import re street = '21 Ramkrishna Road' print(re.sub('Road$', 'Rd.', street)) 将结尾的Road用Rd.替换