劉任昌python串列list集合set字典統計字元數目37,241,不同字元數1,251

file = open('金融常識.txt','r',encoding='utf-8')
reading = file.read()
file.close()
print('檔案字元characters數:', len(reading))
mySet = set(reading)
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]:,}次數")
print(f'劉任昌python計算字元數目{len(reading):,},不同字元數{len(mySet):,}')
print(f'劉任昌python計算字元左圓括號出現的次數{myDict["("]:}')
print(f"劉任昌python計算字元右圓括號出現的次數{myDict[')']:,}")
print(f"劉任昌python計算字元「金」出現的次數{myDict['金']:,}")
print(F'''劉任昌python計算格式化字串統計「管﹞{myDict['管']}''')
字元「殖」出現3次數
字元「百」出現9次數
字元「略」出現7次數
字元「飆」出現1次數
字元「結」出現30次數
字元「仍」出現6次數
字元「取」出現26次數
字元「好」出現21次數
字元「託」出現179次數
字元「面」出現29次數
字元「H」出現2次數
字元「未」出現27次數
字元「午」出現1次數
字元「幫」出現3次數
字元「權」出現96次數
字元「片」出現1次數
字元「棄」出現1次數
字元「櫃」出現18次數
字元「簽」出現18次數
字元「同」出現49次數
字元「外」出現53次數
字元「‧」出現1次數
字元「啟」出現1次數
劉任昌python計算字元數目37,241,不同字元數1,251
劉任昌python計算字元左圓括號出現的次數2061
劉任昌python計算字元右圓括號出現的次數2,061
劉任昌python計算字元「金」出現的次數474
劉任昌python計算格式化字串統計「管﹞115

留言

  1. https://huang070207.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  2. https://star2136.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  3. https://kuozhehao.blogspot.com/2026/10/pythonlistset.html

    回覆刪除
  4. https://leeenming.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  5. https://draft.blogger.com/blog/post/edit/982784999076711761/334663015952956163

    回覆刪除
  6. https://www.blogger.com/blog/post/edit/2808613682252230357/8989366147868642829

    回覆刪除
  7. https://huangzhehui.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  8. https://huang-hsin-ju.blogspot.com/2026/10/pythonlistrset372411251.html

    回覆刪除
  9. https://asdfgktifdjjej.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  10. https://chenyueying.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  11. https://wangzhixian0508.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  12. https://chang-yun-yun.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  13. https://yppp077.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  14. https://leeyousin.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  15. https://lzr0914.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  16. https://ianchen67.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  17. https://wei-chen-chang.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  18. https://www.blogger.com/blog/post/edit/6829750777930789143/9205244959942542069

    回覆刪除
  19. 作者已經移除這則留言。

    回覆刪除
  20. https://www.blogger.com/blog/post/edit/7117219004802242035/2215671963688012033

    回覆刪除
  21. https://yangxinzhen.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  22. https://hsy08311111.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  23. https://lin-takming.blogspot.com/2026/10/pythonlistset37241.html

    回覆刪除
  24. https://ludingfeng.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  25. https://wumeiyingying181818.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  26. https://wangyuzhen.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除
  27. https://jiexin0713.blogspot.com/2026/10/pythonlistset.html

    回覆刪除
  28. https://griuyijglkrijlrtfgfgf.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  29. https://changjiahul.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  30. https://huangpeiling16.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  31. https://teresa18885.blogspot.com/2026/10/blog-post.html

    回覆刪除
  32. https://zhiyao01.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  33. https://chenjunjie592.blogspot.com/2026/10/blog-post.html

    回覆刪除
  34. https://zhonghexiao.blogspot.com/2026/10/w3schoolsstrlistsetdicttuple-10-04-2026.html

    回覆刪除
  35. https://leexinni819.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  36. https://cynthia088.blogspot.com/2026/10/file-open.html

    回覆刪除
  37. https://liushaouchi.blogspot.com/2026/10/pythonlistset372411251.html

    回覆刪除
  38. https://yubiyu.blogspot.com/2026/10/pythonsetdict372411251.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

劉任昌python字串方法in找到特定「題號」和題目

劉任昌Python產生金融常識Javascript測驗網頁

劉任昌EXCEL函數LEFT,MID,RIGHT及PYTHON方法FIND