1. 程式人生 > >遇到Python中文目錄名問題,未解決

遇到Python中文目錄名問題,未解決

 程式碼如下:

import pandas as pd

import matplotlib.pyplot as plot  
                         
# filePath = ("e://data/dataTest.csv")
filePath = ("E://TensorFlow深度學習應用實踐/data/dataTest.csv")

dataFile = pd.read_csv(filePath,header=None, prefix="V")

dataRow1 = dataFile.iloc[100,1:300]                      
dataRow2 = dataFile.iloc[101,1:300]                      
plot.scatter(dataRow1, dataRow2)                        
plot.xlabel("Attribute1")                             
plot.ylabel("Attribute2")                             
plot.show()    

吾嘗試了多種寫法,都不成功:

filePath = (u"E://TensorFlow深度學習應用實踐/data/dataTest.csv")
filePath = (r"E://TensorFlow深度學習應用實踐/data/dataTest.csv")
filePath = ("E://TensorFlow深度學習應用實踐/data/dataTest.csv".encode('gbk'))

filePath = unicode("E://TensorFlow深度學習應用實踐/data/dataTest.csv", "utf-8") 

#-*- coding:cp936 -*-