0

Hi? i'm new at programming and im trying to decipher a code. i'm trying to count how many times a char occurs in txt file

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by ihatehippies
0

Thanks.. i got it another way.. i converted the string into ascii values then saved them into a list.
i then used a list.count(i) to see how many times a certain value occurred.. thanks again

1

to find the letter that occurs the most you can do:

File = open("path", "rb")
txt = File.read()
File.close()

mode = max(txt, key=txt.count)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.