fn1="input.txt"
fn2="output.txt" #"output.html"
fp=open(fn1,"rt")
output_data=[]
while True:
line1=fp.readline()
if line1=="":break
line2=fp.readline()
line3=fp.readline()
output_data.append((line2,line1,line3))
HTML=2
TXT=1
outputtype=HTML
if fn2.endswith("html"):
outputtype=HTML
else:
outputtype=TXT
if outputtype==HTML:
begins="
File Name | Date Created | Number of Bytes |
---|
webfilename = "output.html"
import time
fileName=raw_input('Enter the name of file you want to process: ')
f=open(fileName,'r')
main_heading = '\n'+'%35s'%('My Graphics Library')+'\n'
column_heading = '\n'+'%-19s%0s%20s'%('File Name','Date Created','Number of Bytes')+'\n'
print '\n'+'%35s'%('My Graphics Library')+'\n'
print '\n'+'%-19s%0s%20s'%('File Name','Date Created','Number of Bytes')+'\n'
output_data=[]
date=f.readline().strip()
sumTotal=0
while date!='':
currentYear=time.strftime('%Y',time.strptime(date,'%m/%d/%Y'))
previousYear=currentYear
total=0
sumTotal+=total
while currentYear==previousYear:
name=f.readline().strip()
size=float(f.readline().strip())
print '%-20s%0s%17s' % (name,date,size)
date=f.readline().strip()
total+=size
if date!='':
currentYear=time.strftime('%Y',time.strptime(date,'%m/%d/%Y'))
else:
break
output_data.append((name,date,size))
sumTotal+=total
print '\n'+'%-20s%9s' %('Total Bytes for Files Creadted in '+previousYear,total)+'\n'
print '%-20s%22s' %('Total Bytes for All Files',sumTotal)
choice = raw_input('Do you want open it in web(yes,no): ')
if choice == "yes":
begins = "
File Name | Date Created | Number of Bytes |
---|