Re: learning python, using string help

2006-02-03 Thread Tom Anderson
On Fri, 2 Feb 2006, [EMAIL PROTECTED] wrote: > silly newbie mistake > > your code runs fine on my openbsd box. ( I didnt uncomment the return > map(...) line My apologies - i should have made it clearer in the comment that it was hardwired to return example data! > thanks for the awesome exampl

Re: learning python, using string help

2006-02-02 Thread [EMAIL PROTECTED]
silly newbie mistake your code runs fine on my openbsd box. ( I didnt uncomment the return map(...) line thanks for the awesome example! --mike -- http://mail.python.org/mailman/listinfo/python-list

Re: learning python, using string help

2006-02-02 Thread [EMAIL PROTECTED]
Tom, the script you referenced me errored ... But I will see if I can get it working. -- http://mail.python.org/mailman/listinfo/python-list

Re: learning python, using string help

2006-02-02 Thread [EMAIL PROTECTED]
thanks tom, I am running OpenBSD, NetBSD as well as OS X (FreeBSD) My first python script #!/usr/local/bin/python print "Content-type:text/html\n\n"; import os, string getrup = os.popen('ruptime').read() show = getrup.splitlines() for line in show: if line.find("up" or "down"):

Re: learning python, using string help

2006-02-02 Thread Tom Anderson
On Thu, 2 Feb 2006, [EMAIL PROTECTED] wrote: > Well, I did want to add some formatting for example I getcha. This is really an HTML problem rather than a python problem, isn't it? What you need to do is output a table. FWIW, here's how i'd do it (assuming you've got HP-UX ruptime, since that's

Re: learning python, using string help

2006-02-02 Thread [EMAIL PROTECTED]
Well, I did want to add some formatting for example STATUS = "up" getrup = os.popen('ruptime').read() show = getrup.splitlines() gethost = show[0] hostname = gethost.split() print hostname[0] getstatus = hostname[1] if getstatus.find("STATUS"): print STATUS else: print "HOST DOWN

Re: learning python, using string help

2006-02-02 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi all, > > I have a simple snippet I am trying to keep the format the same as > plain text, though I want to embed it in html ... > > basically, > > print "Content-type:text/plain\n\n"; > getrup = os.popen('ruptime').read() > print get

learning python, using string help

2006-02-02 Thread [EMAIL PROTECTED]
hi all, I have a simple snippet I am trying to keep the format the same as plain text, though I want to embed it in html ... basically, print "Content-type:text/plain\n\n"; getrup = os.popen('ruptime').read() print getrup is the same format as if I ran 'ruptime' from the command line. If I use