开发者

I need to find how much a combinations of letters are repeated in a txt file with random 200 letters and put them in a list

开发者 https://www.devze.com 2022-12-07 22:21 出处:网络
So i have to create a list that determines the amount of certain letters appear in a combination said above. Forexample letters from A to E repeats 57 times. How would i code this in python?Picture of

So i have to create a list that determines the amount of certain letters appear in a combination said above. For example letters from A to E repeats 57 times. How would i code this in python?Picture of the question

plzz help! and thank you

ive tried this already


# Input section
print("(1)  Find the number of lines in a file.")
fin = open("inputFileAssig.txt", "r")
numLines = len(fin.readlines())
fin.close()

# Processing section
fin = open("inputFileAssig.txt&qu开发者_如何学Goot;, "r")
lstData = []
for index in range(0, numLines):
    line = fin.readline()
    line = line.replace("\n", "")
    lstData.append(line)
print(lstData)             # delete later
fin.close()

# Output section

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号