[問題] python 2.6 中的中文處理
請問一下各位前輩
小弟用的是python 2.6
再處理中文的時候會有問題
以下為程式碼範例
# -*- coding: utf-8 -*-
import os
listDoc2 = os.listdir('c:\\test2')
print listDoc2
szParam_2 = 'C:\\公司軟體'
print szParam_2
listDoc = os.listdir(szParam_2)
print listDoc
print listDoc2 的時候如果裡頭的檔名有中文的話無法正常顯示
print szParam_2 的時候正常
listDoc = os.listdir(szParam_2) 則編譯的時候會有錯誤
請問除了用python 3.0 之外
是否還有好的解決方式
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.220.110.100
推
12/21 15:41, , 1F
12/21 15:41, 1F
→
12/21 15:42, , 2F
12/21 15:42, 2F
推
12/21 15:46, , 3F
12/21 15:46, 3F
Python 近期熱門文章
PTT數位生活區 即時熱門文章