#!"C:\python34\python.exe"
import cgi, cgitb
cgitb.enable()
print("Content-Type: text/html;charset=utf-8")
print()
print ("Enter a file name:")
a = int(input("enter input"))
print (a)
但它的错误是
D:\xampp\cgi-bin\ex3.py in ()
6 print()
7
8 print ("Enter a file name:")
=> 9 a = int(input("enter input"))
10 print (a)
a undefined, builtin int = <class 'int'>, builtin input = <built-in function input>
EOFError: EOF when reading a line
args = ('EOF when reading a line',)
with_traceback = <built-in method with_traceback of EOFError object>
答案 0 :(得分:0)
如果您的程序需要文件名(字符串),那么您不需要转换为整数。
print ("Enter a file name:")
a = input("enter input ")
print (a)
如果输入字符串,则此方法有效。