python - how to get the user entered input -
iam beginner python started trying simple programs , below code 1 in .getting user entered input , printing it.and running code in local host http://localhost/cgi-bin/ex3.py given below code simple python code
#!"c:\python34\python.exe" import cgi, cgitb cgitb.enable() print("content-type: text/html;charset=utf-8") print() print ("enter file name:") = int(input("enter input")) print (a)
but it's giving error as
d:\xampp\cgi-bin\ex3.py in () 6 print() 7 8 print ("enter file name:") => 9 = int(input("enter input")) 10 print (a) undefined, builtin int = <class 'int'>, builtin input = <built-in function input> eoferror: eof when reading line args = ('eof when reading line',) with_traceback = <built-in method with_traceback of eoferror object>
if program expects file name (string) don't need cast integer.
print ("enter file name:") = input("enter input ") print (a)
this works if enter string.
Comments
Post a Comment