0
我使用Python 3.5和PyCharm。python:我想讀取包含中文的csv文件,我使用'reload(sys)',但它不能工作
我的代碼:
import importlib,sys
importlib.reload (sys)
sys.setdefaultencoding("utf-8")
錯誤:
sys.setdefaultencoding("utf-8")
AttributeError: module 'sys' has no attribute 'setdefaultencoding'
謝謝! sys sys.stdout.encoding a = pd.read_csv('student.csv','r','utf-8') print(a [:5]).....它有效,但有一個警告:ParserWarning:回落到' python'引擎,因爲'c'引擎不支持正則表達式分隔符(分隔符> 1個字符,與'\ s +'不同'被解釋爲正則表達式);你可以通過指定engine ='python'來避免這個警告。 我用worng的方式來閱讀這個文件嗎? –