Skip to content

Commit c0c32ae

Browse files
authored
Create CountMillionCharacters-2.0.py
1 parent ef4988b commit c0c32ae

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

CountMillionCharacters-2.0.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Get the number of each character in any given text.
2+
3+
Inputs:
4+
A txt file -- You will be asked for an input file. Simply input the name
5+
of the txt file in which you have the desired text.
6+
7+
"""
8+
9+
import pprint
10+
import collections
11+
12+
13+
def main():
14+
15+
file_input = input('File Name: ')
16+
17+
with open(file_input, 'r') as info:
18+
count = collections.Counter(info.read().upper())
19+
20+
value = pprint.pformat(count)
21+
print(value)
22+
23+
if __name__ == "__main__":
24+
main()

0 commit comments

Comments
 (0)