我有一个包含特殊字符的文件,所以我使用文件操作来读取。
f=open('st.txt','r')
string=f.read()
示例字符串是
"Free Quote!\n \n Protecting your family is the best investment you\'ll eve=\nr \n"
现在我想删除所有特殊字符并只从字符串中获取单词。这样我的字符串将是:
"Free Quote Protecting your family is the best investment you'll ever"