#reformat python script as HTML comface = "Times New Roman" codeface = "Courier New" import fileinput import sys pagewidth = 118 if len(sys.argv) < 3: print "usage: python tab.py inputfile outputfile" print print x = 0/0 ofil = open(sys.argv[2], "w") #ofil = open("2.txt", "w") ofil.write("
") state = "code" #note that formatting characters must be in sequence: #, _, / for o in fileinput.input(sys.argv[1]): oldstate = state if (o[0] == '#') and (o[1] != '*'): #if this line is comment-only state = "comment" top = "" cap = "" if (o[1] == '#') and (o[2] == '#') and (o[3] == '#'): # '####' means big header top += "')
ofil.write(o)
ofil.write("")
ofil.close()