hi today I have tried a file program to fine the word counts in a file
def fileprogram(filename):
f=open(filename,'r')
wordcount=0
for lines in f:
f1=lines.split()
wordcount=wordcount+len(f1)
f.close()
print 'word count:', str(wordcount)
fileprogram(raw_input("enter file name:"))
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment