以下代码用 '' 替换给定字符串中的所有字符示例import re line = 'this is a text with in between and then there are instances ... where the number ranges from 0-99.\ and there are many other lines in the text files \ with such tags ' line = re.sub(r"", "", line) print line输出这将输出this is a text with in between and then there are instances ... where the number ranges from 0-99.and there are many other lines in the text files with such tags