-1
これは、Python 3.5.1シェルでのプリントアウトです:FileNotFoundError:[Errno 2]ファイルとパスが確認されましたか?
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'
私が間違って何を読んでいますか?私は.txtファイル "hello"を持っていて、パスが検証されています。
'hello'と' hello.txt'は、2つの異なるファイルです。あなたは 'hello.txt'と呼ばれていますか?そうである場合、別の違いは、あなたの実際のパスに '\ Python \'が大文字の 'P'を含み、' \ python \ 'で小文字の' p'を持つパスを開こうとしている間です。私が知っている限り、Windows上では問題ありませんが、とにかくショットに値するはずです。 – marcelm