使用方法 import re def delete_boring_characters(sentence): return re.sub('[0-9’!"#$%&\'()*+,-./:;<=>?@,。?★、…【】《》?“”‘’![\\]^_`{|}~\s]+', "", sentence) if __name__ == '__main__': clean_str = delete_boring_characters('[Helloworld!!!!]') print(clean_str) # Helloworld