我有這樣的代碼:TXT:FileNotFoundError:[錯誤2]沒有這樣的文件或目錄
file_lamma = open("https://stackoverflow.com/users/costanzanaldi/scrivania/filelamma.txt",'r')
for linea in file_lamma.readlines():
linea = linea.strip().split(' ')
輸出爲:
runfile('/Users/costanzanaldi/Dropbox/Tesi_Naldi/COdice _Python/NUOVO/pannellopiano2.py', wdir='/Users/costanzanaldi/Dropbox/Tesi_Naldi/COdice _Python/NUOVO')
Traceback (most recent call last):
File "<ipython-input-5-c4acfa74cc68>", line 1, in <module>
runfile('/Users/costanzanaldi/Dropbox/Tesi_Naldi/COdice _Python/NUOVO/pannellopiano2.py', wdir='/Users/costanzanaldi/Dropbox/Tesi_Naldi/COdice _Python/NUOVO')
File "/Users/costanzanaldi/anaconda/lib/python3.4/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "/Users/costanzanaldi/anaconda/lib/python3.4/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 85, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/Users/costanzanaldi/Dropbox/Tesi_Naldi/COdice _Python/NUOVO/pannellopiano2.py", line 59, in <module>
file_lamma = open("https://stackoverflow.com/users/costanzanaldi/scrivania/filelamma.txt",'r')
FileNotFoundError: [Errno 2] No such file or directory: '/users/costanzanaldi/scrivania/filelamma.txt'
文件的名稱和路徑是正確的?我不知道該怎麼辦
謝謝