Python3中創建文件夾目錄的時候特殊符號處理轉義

# 創建目錄的時候,不能包含一些特殊字符要轉義
news_title = ''
char_list = ['*','|',':','?','/','<','>','"','\\']
news_title_result = news_title
for i in char_list:
    if i in news_title :
        news_title_result = news_title.replace(i,"_")

 

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