python 過濾中文、英文特殊符號

python 過濾中文、英文特殊符號

python2: allname = re.sub("[\s+\.\!\/_,$%^*(+\"\')]+|[+——()?【】“”!,。?、~@#¥%……&*()]+", "",allname)

python3:re.sub("[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()]+".encode('utf-8').decode('utf-8'), "".encode('utf-8').decode('utf-8'),line)

 

參考:https://blog.csdn.net/nlite827109223/article/details/62237733?utm_source=distribute.pc_relevant.none-task

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章