Dies ist der Ausdruck in Python 3.5.1 Shell:FileNotFoundError: [Errno 2] Datei und Pfad verifiziert?
import os
os.getcwd()
'C:\\Users\\victoria\\AppData\\Local\\Programs\\Python\\Python35-32'
>>> import os
>>> os.path.abspath('.\\hello')
'C:\\Users\\victoria\\AppData\\Local\\Programs\\Python\\Python35-32\\hello'
>>> helloFile = open('C:\\Users\\victoria\\AppData\\Local\\Programs\\python\\Python35-32\\hello.txt')
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
helloFile = open('C:\\Users\\victoria\\AppData\\Local\\Programs\\python\\Python35-32\\hello.txt')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\victoria\\AppData\\Local\\Programs\\python\\Python35-32\\hello.txt'
Was ich falsch lese? Ich habe die .txt Datei "Hallo" und es ist Pfad verifiziert.
'hello' und' hello.txt' sind zwei verschiedene Dateien verwenden. Sind Sie sicher, dass Ihre "hello.txt" heißt? Wenn dies der Fall ist, besteht ein weiterer Unterschied darin, dass Ihr tatsächlicher Pfad '\ Python \' mit einem großen 'P' enthält, während Sie versuchen, einen Pfad mit' \ python \ 'mit einem Kleinbuchstaben' p' zu öffnen. Sollte auf Windows soweit ich weiß nichts ausmachen, aber trotzdem einen Versuch wert. – marcelm