Programming Pandit

c/c++/c#/Javav/Python


Latest Update

Monday, November 23, 2020

Python program to count number of words in a file by G Krishna Chauhan

Source Code

f=open("demo.txt")


str=f.read()

L=str.split()

count_word=0

for i in L:

    count_word=count_word+1

print(count_word)


f.close()




OUTPUT 


File :  This is python programming and PHP programming.

7



No comments:

Post a Comment