use lines as argument to a command
Amit Khemka
khemkaamit at gmail.com
Mon Oct 15 02:59:13 EDT 2007
On 10/15/07, Shoryuken <sakradevanamindra at gmail.com> wrote:
> I'm new to Python, so my question may sounds naive. Here is it.
>
> I have a text file like this:
>
> www.a.com
> www.b.com
> www.c.com
> ...
>
> I want to read one line from this file at a time, which I know how to
> do. And use it as an argument to a command, for example, telnet www.a.com
> and so on. However I have no idea how to do this task.
I guess that you want to loop over a file and for each line in the
file you want to call some
external program with the line as the argument.
Have a look at subprocess module
http://docs.python.org/lib/module-subprocess.html
If there is some else that you meant, please specify .
Cheers,
--
--
Amit Khemka
More information about the Python-list
mailing list