use lines as argument to a command
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. My purpose is to generate a brief report. Thank you in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: use lines as argument to a command
> 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 Thanks alot, its working now. But I have another question (sorry I'm so noob), how can I redirect a command's output to a file (just like executing a linux command "dmesg>>stat.txt")? -- http://mail.python.org/mailman/listinfo/python-list
a newbie regex question
Given a regular expression pattern, for example, \([A-Z].+[a-z]\), print out all strings that match the pattern in a file Anyone tell me a way to do it? I know it's easy, but i'm completely new to python thanks alot -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamically associate radio buttons with droplists
On Jun 21, 8:43 pm, a...@pythoncraft.com (Aahz) wrote: > In article > ,LeoBrugud > wrote: > > > > >Not being very familiar with python, nor with cgi/http, I intend to > >have 3 of buttons in a webpage, each of them is associate with a file > >(so I have 3 files, too) > > >What I would like to have is, when users choose a button, the droplist > >update automatically to load the contents of the associated file. > > >Can someone educate me the approach of this? > > Are you trying to do this without requiring the user to click the submit > button? If yes, you need to learn JavaScript (although I think there are > web frameworks that will auto-generate the JavaScript, you need to know > JavaScript in order to do debugging). > -- > Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ > > "as long as we like the same operating system, things are cool." --piranha Thanks, and yes I want to do it without the submit button So python alone cannot do this? -- http://mail.python.org/mailman/listinfo/python-list