[問題] 簡中繁中輸入問題
目前在寫一個軟體透過 python 將輸入的文字轉成 QR code 後儲存
儲存目的地可以指定目錄,目錄名稱繁中簡中都有可能,在 Mac 以及 Linux
的環境下執行都很順利,但在 Windows 下,繁中的 Windows 目錄名稱為簡中
的話就會印出目錄不存在,因為 stdin 簡中的字 python 吃到會變亂碼,像是
python qr.py 簡体中文 <- (簡的簡體字 ptt 好像也不能打)
print(repr(sys.argv[1])) 會變成 ?\xca^\xa4\xa4\xa4\xe5
os.path.exists(sys.argv[1]) 是不存在的
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.124.224.43
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1545115914.A.9D2.html
→
12/18 15:08,
6年前
, 1F
12/18 15:08, 1F
※ 編輯: chan15 (59.124.224.43), 12/18/2018 17:20:20
→
12/19 12:45,
6年前
, 2F
12/19 12:45, 2F
Python 近期熱門文章
PTT數位生活區 即時熱門文章