Input from the same file as the script
Georg Brandl
g.brandl-nospam at gmx.net
Sun Aug 20 14:08:38 EDT 2006
poggle.themammal at gmail.com wrote:
> 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.
*sigh* Why do you think that we could guess what error this may be?
In this case, it is likely a SyntaxError because you used input() instead
of raw_input().
> 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"
>
Georg
More information about the Python-list
mailing list