Python program that takes a text file as input and returns the number of words of a given text file
with open('file1.txt','r+') as f:
lines=f.read()
words=lines.split()
print(len(words))
Python program that takes a text file as input and returns the number of words of a given text file
with open('file1.txt','r+') as f:
lines=f.read()
words=lines.split()
print(len(words))
Python program that takes a text file as input and returns the number of words of a given text file
with open('file1.txt','r+') as f:
numw=0
for line in f:
words= line.split()
print(words)
numw += len(words)
print(numw)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us