# 正则将匹配到的两个字段,都替换成某个值
import re s0 = 'BOY and GIRL'
s1 = re.sub(r'BOY|GIRL', 'HUMAN', s0)
print s1
# HUMAN and HUMAN
04-27 05:25