陳姵儒python集合set字典dict統計字元數目37241不同字元數1251
file = open('金融常識.txt','r',encoding='utf-8')
reading = file.read()
file.close()
print('檔案字元characters數:', len(reading))
mySet = set(reading)
mySet=dict()
for j in mySet:
myDict[j]=0
for i in reading:
myDict[i]+=1
for j in mySet:
print(f"字元"「{j}」出現{myDict[j]:,}次數")
print(f'字元數目{len(reading):,},不同字元數{len(mySet):,}')
print(f"陳姵儒統計左引號(出現次數{myDict['(']:,}")
print(f'陳姵儒統計右引號)出現次數{myDict[")"]:,}')
print(f'陳姵儒統計504每題四個選項至少有{504*4:,}')
商業軟體。https://hannie0-hannie.blogspot.com/2026/10/excelmatchindexisnumber.html
回覆刪除1113.typescript俄羅斯方塊。https://hannie0-hannie.blogspot.com/2026/11/typescriptjavascripttetris.html
https://hannie0-hannie.blogspot.com/2026/10/pythoninputfind-1.html
https://hannie0-hannie.blogspot.com/2026/10/pythonsetdict372411251.html