sub是替換的功能
sub(模型,替換為的字符,目標原字符串,替換次數)
import re
yuanchuan='1qaz2wsx3edc4rfv5tgb'
new_str=re.sub('\d','INTNUM',yuanchuan,2) ?#若果沒有2表示默認替換所有的
print (new_str)
#輸出結果為:INTNUMqazINTNUMwsx3edc4rfv5tgb
re.subn(new_str,count)#返回的是元組,包含的是新字符串和匹配了多少次 ?兩個值
?