Georg Brandl <[EMAIL PROTECTED]> writes on Sun, 20 Aug 2006 20:08:38 +0200:
> [EMAIL PROTECTED] 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.
The easiest way would be:
data = '''\
here comes your data
...
'''
# and now you use it
... data ...
# you can even wrap it into a file
from StringIO import StringIO
data_as_file = StringIO(data)
... data_as_file.readline() ...
--
Dieter
--
http://mail.python.org/mailman/listinfo/python-list