import re s0 = 'BOY and GIRL' s1 = re.sub(r'BOY|GIRL', 'HUMAN', s0) print s1 # HUMAN and HUMAN 替换方法。 相关文章: 2019-02-26 2021-05-25 2021-10-01 2022-12-23 2021-10-29 2021-12-13