Skip to content
Permalink
Branch: master
Find file Copy path
4 contributors

Users who have contributed to this file

@Brikaa @walidmujahid @VishvajitP @bhavsec
27 lines (20 sloc) 589 Bytes
"""Get the number of each character in any given text.
Inputs:
A txt file -- You will be asked for an input file. Simply input the name
of the txt file in which you have the desired text.
"""
import pprint
import collections
def main():
file_input = input('File Name: ')
try:
with open(file_input, 'r') as info:
count = collections.Counter(info.read().upper())
except FileNotFoundError:
print("Please enter a valid file name.")
main()
value = pprint.pformat(count)
print(value)
exit()
if __name__ == "__main__":
main()
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.