張善喆python集合set字典dict統計字元數目37,241不同字元數1,251
file = open('金融常識.txt','r',encoding='utf-8')
reading = file.read()
file.close()
print('檔案字元characters數:', len(reading))
mySet = set(reading)
print(f'字元數目{len(reading):,},不同字元數{len(mySet):,}')
myDict = dict()
for j in mySet:
myDict[j] = 0
for i in reading:
myDict[i] += 1
for j in mySet:
print(f"字元「{j}」出現{myDict[j]:,}次數")
商業軟體,沒有表格
回覆刪除格。https://trfbvuytrgoij.blogspot.com/2026/11/excelformulas.html
這個錯誤,必須在HTML模式貼上才能執行。https://trfbvuytrgoij.blogspot.com/2026/09/blog-post.html
補以前的.https://trfbvuytrgoij.blogspot.com/2026/11/file-open.html
期中考,沒有嵌入影片。https://trfbvuytrgoij.blogspot.com/2026/11/htmlcssjavascriptpython.htm
https://trfbvuytrgoij.blogspot.com/2026/10/pythonsetdict372411251.htmll