chomp?

Discussion in 'Python' started by Matt Herzog, Oct 17, 2008.

  1. Matt Herzog

    Matt Herzog Guest

    Hey Pythons.

    This script works fine except I would like it to NOT print everything on a newline.
    How can I tell print to chomp?

    Thanks.

    ------------------------------- snip ---------------------------------------------
    #!/usr/bin/python
    import time
    import sys

    def getload():
    f = open('/proc/loadavg')
    data = f.readline()
    f.close()
    (load1, load2, load3, extra) = data.split(' ',3)
    return float(load1)

    done = False
    while not done:
    while getload() < 3:
    print getload()
    time.sleep(3)

    # we left the loop!
    print "Ouch! My CPUs are roasting!
    time.sleep(3)

    --
    "'My country, right or wrong,' is a thing that no patriot would think of saying. It is like saying, 'My mother, drunk or sober.'"

    -- G.K. Chesterton
     
    Matt Herzog, Oct 17, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Powell
    Replies:
    0
    Views:
    1,218
    Aaron Powell
    Jul 24, 2003
  2. Matt Taylor

    Question on Chomp

    Matt Taylor, Sep 29, 2003, in forum: Perl
    Replies:
    2
    Views:
    391
    Matt Taylor
    Sep 29, 2003
  3. Fernando Armenta

    How you chomp in python

    Fernando Armenta, Sep 20, 2003, in forum: Python
    Replies:
    3
    Views:
    8,613
  4. Jeremy Dillworth

    Re: How you chomp in python

    Jeremy Dillworth, Sep 20, 2003, in forum: Python
    Replies:
    0
    Views:
    979
    Jeremy Dillworth
    Sep 20, 2003
  5. martin
    Replies:
    3
    Views:
    200
    Joe Smith
    Apr 15, 2006
Loading...

Share This Page