1
當我使用流重定向執行python腳本時,我不斷收到EOF錯誤。使用流重定向執行python腳本EOF錯誤
腳本
name=input('Enter your name : ')
print ('Welcome ' + name)
input('Press \'ENTER\' to exit!')
執行指令:
helloworld.py < input.dat
錯誤:
Enter your name : Welcome Gunit
Press 'ENTER' to exit!Traceback (most recent call last):
File "D:\Reference\Python\Codes\helloworld.py", line 28, in <module>
input('Press \'ENTER\' to exit!')
EOFError: EOF when reading a line
謝謝...它的工作...我在input.dat中有2行,但第二行沒有字符可通過input()讀取... –