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

Re: string help

2005-11-15 Thread Steven D'Aprano
On Tue, 15 Nov 2005 09:35:00 +, Simon Brunning wrote: > On 14/11/05, john boy <[EMAIL PROTECTED]> wrote: >> using the following program: >> >> prefixes = "JKLMNOPQ" >> suffix = "ack" >> for letter in prefixes: >> print letter + suffix >> if prefixes == "O" or "Q" > > Here you need: >

Re: string help

2005-11-15 Thread Simon Brunning
On 14/11/05, john boy <[EMAIL PROTECTED]> wrote: > using the following program: > > prefixes = "JKLMNOPQ" > suffix = "ack" > for letter in prefixes: > print letter + suffix > if prefixes == "O" or "Q" Here you need: if prefixes == "O" or prefixes == "Q" >print letter + "u" + suf

Re: string help

2005-11-15 Thread Miki Tebeka
Hello John, >using the following program: > > > >prefixes = "JKLMNOPQ" > >suffix = "ack" > >for letter in prefixes: > >print letter + suffix > >if prefixes == "O" or "Q" if (letter == "O") or (letter == "Q"): > > print letter + "u" + suffi

string help

2005-11-15 Thread john boy
using the following program:   prefixes = "JKLMNOPQ" suffix = "ack" for letter in prefixes:     print letter + suffix     if prefixes == "O" or "Q"    print letter + "u" + suffix   For this program I am trying to combine the individual letters with the suffix to form names...but for O and Q I n