# -*- coding: utf-8 -*-
"""
Created on Thu Oct 10 02:24:35 2019

@author: Faradars-pc2
"""

def shomareshe_tedade_kalamt(esme_file):
    try:
        with open(esme_file) as f:
            mohtaviat = f.read()
    except FileNotFoundError:
        print('file moshakhas shode vojud nadarad.')
#        pass
    else:
        kalamat = mohtaviat.split()
        tedad_kalamat = len(kalamat)
        print(f'file {esme_file} daraye {tedad_kalamat} kalame mibashad') 
        
esme_file = ['data1.txt','abc.txt','data2w.txt','data3w.txt']
for esm in esme_file:
    shomareshe_tedade_kalamt(esm) 
       