Revision: 32300
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 22, 2010 02:20 by magicrebirth
Initial Code
#!/usr/local/bin/python
import sys
import time
havevalue = 0
while havevalue < 1:
        try:
                table = input("What table to you want? ")
                havevalue=1
        except:
                print "Looking for a number"
counter = 1
save = open("tabout.txt","w")
while counter <= 12:
        result = table * counter
        print counter,"time",table, "is",result
        save.write (str(counter) " times "  \
                str(table)  " is "  \
                str(result)  "\n")
        counter = counter  1
print "Counter ends at",counter
save.close();
handle = open("logfile.txt","a")
logline = []
logline.append(sys.argv[0])
logline.append(str(time.time()))
logline.append(str(table))
handle.write(("Â ".join(logline)) "\n")
handle.close()
Initial URL
http://www.wellho.net/resources/ex.php4?item=y110/tablog.py
Initial Description
Initial Title
File overwrite and append in python
Initial Tags
file
Initial Language
Python