chomp?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt Herzog

    chomp?

    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
Working...