Re: Execute commands from file
- From: "Martin Blume" <mblume@xxxxxxxxx>
- Date: Wed, 16 May 2007 18:53:31 +0200
"tmp123" schrieb >
We have very big files with python commands
(more or less, 500000 commands each file).
It is possible to execute them command by command,
inp = open(cmd_file)
for line in inp:
exec line
might help. You don't get quite the same feeling as
"like if the commands was typed one after the other
in a interactive session", but perhaps this helps.
Warning: the code above is without any error checks.
You might also run into security problems, the example
above assumes you trust your input.
HTH. YMMV.
Martin
.
- Follow-Ups:
- Re: Execute commands from file
- From: Steve Holden
- Re: Execute commands from file
- References:
- Execute commands from file
- From: tmp123
- Execute commands from file
- Prev by Date: Re: calldll for Python 2.5
- Next by Date: Re: PEP 3131: Supporting Non-ASCII Identifiers
- Previous by thread: Re: Execute commands from file
- Next by thread: Re: Execute commands from file
- Index(es):
Relevant Pages
|
|