0
我很確定我在mystuff文件夾中有ex15_sample.txt!爲什麼我不能在PowerShell中打開並閱讀python文件?
IOError: [Errno 2] No such file or directory: 'ex15_sample.txt'
這是我的代碼
from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print txt.read()
print "Type the filename again:"
file_again = raw_input("> ")
txt_again = open(file_again)
print txt_again.read() `
你遇到什麼錯誤/ s的? – shiva
也許'python.exe'以不同的工作目錄開始。 os.getcwd()'的輸出是什麼? –
dir命令的輸出是什麼? – YOU