나는 운동 17에서 일하고 있는데, 달리기가 불가능한 것 같습니다.learnpythonthehardway exercise 17 not working
나는 python test.py raw.txt copied.txt
처럼 실행되지만이 오류가 나타납니다
Copying from raw.txt to copied.txt
Traceback (most recent call last):
File "test.py", line 9, in <module>
in_file = open(from_file)
IOError: [Errno 2] No such file or directory: 'raw.txt'
내 코드 : 이제 모든 파일을 :을 os.path 수입에서 SYS 수입 ARGV 에서 이
script, from_file, to_file = argv
print "Copying from %s to %s" % (from_file, to_file)
# we could do these two on one line too, how?
in_file = open(from_file)
indata = in_file.read()
print "The input file is %d bytes long" % len(indata)
print "Does the output file exist? %r" % exists(to_file)
print "Ready, hit RETURN to continue, CTRL-C to abort."
raw_input()
out_file = open(to_file, 'w')
out_file.write(indata)
print "Alright, all done."
out_file.close()
in_file.close()
트레이스 백은 텍스트입니다. 여기에 복사하여 붙여 넣을 수 있습니다. –
은'python' 디렉토리에서'raw.txt'입니까? –