To write a python program for getting the word count from the contents of a file using command line arguments.
PC Anaconda - Python 3.7
'''
python program for getting the word count from the contents of a file using command line arguments.
Develpoed By: S.Shashin prasad
RegisterNumber:212222230144
'''
import sys
count=0
fp=open(sys.argv[1],'r')
for line in fp:
list1=line.split()
count+=len(list1)
print("no of words in a file",count)
Thus the program is written to find the word count from the contents of a file using command line arguments.