user image

Preeti Tripathi

Job Interview Skills
English
2 years ago

68. Create a program that counts each character in a given text file.

user image

Abhishek Mishra

2 years ago

The concept is to use the pprint module and collections as illustrated below:import collectionsimport pprintwith open("sample_file.txt", 'r') as data: count_data = collections.Counter(data.read().upper()) count_value = pprint.pformat(count_data)print(count_value)

Recent Doubts

Close [x]