czwartek, 28 listopada 2013

file reader python

#!/usr/bin/python

import time

try:
    f = file('/etc/passwd')
    while True:
        line = f.readline()
        if len(line) == 0:
            break
        time.sleep(2)
        print line,
finally:
    f.close()
    print "cleaning up ... closed the file"

almost like kindle :)


Brak komentarzy:

Prześlij komentarz