Input from the same file as the script

poggle.themammal at gmail.com poggle.themammal at gmail.com
Sun Aug 20 14:02:25 EDT 2006


Can the input to the python script be given from the same file as the
script itself. e.g., when we execute a python script with the command
'python <scriptName', can the input be given in someway ?

When I ran the below the python interpreter gave an error.

e.g.,
scriptName:
-----------
x = input("The value of x is taken from the source code file itself as
input is redirected to it")

print x

"Value intended for the variable x"




More information about the Python-list mailing list