劉任昌檔案處理

f = open("ascii.txt", "r",encoding='utf8')
print(f.read())
f.close()
x = "劉任昌"
f = open("ascii.txt", "r+",encoding='utf8')
y = f.write(x)
print(y)
f.close()
f = open("ascii.txt", "r+",encoding='utf8') #a代表附加append
print("名稱",f.name)
print("模式",f.mode)
print("關閉",f.closed)
f.write('劉任昌')
line = f.read() #讀取檔案f成為字串
print('檔案字串長度',len(line))
print("檔案內容",line)
f.close()

380

留言

  1. https://laiweikaiaaa.blogspot.com/2024/03/blog-post.html

    回覆刪除
  2. https://stanley-ouo.blogspot.com/2024/03/378-file-open-ascii.html

    回覆刪除
  3. https://yangyoyo0125.blogspot.com/2024/03/blog-post.html

    回覆刪除
  4. https://yiingxxn.blogspot.com/2024/03/htmlcssjavascriptjavapython.html

    回覆刪除
  5. https://kuoyiting.blogspot.com/2024/03/f-openascii.html

    回覆刪除
  6. https://e99136.blogspot.com/2024/03/blog-post.html

    回覆刪除
  7. https://sandy06252023.blogspot.com/2024/03/blog-post.html

    回覆刪除
  8. https://wujiaqi1010.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  9. https://hank20050328.blogspot.com/2024/03/blog-post.html

    回覆刪除
  10. https://zhen-zhen4869.blogspot.com/2024/03/blog-post.html

    回覆刪除
  11. https://www.blogger.com/blog/post/edit/preview/5779881926535543652/5927925602930160843

    回覆刪除
  12. https://caipeishan1223.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  13. https://kitty030994.blogspot.com/2024/03/blog-post.html

    回覆刪除
  14. https://zhangxinzi.blogspot.com/2024/03/f-openascii.html


    回覆刪除
  15. https://liu-guang-wei.blogspot.com/2024/03/blog-post.html

    回覆刪除
  16. https://chienyinghuan.blogspot.com/2024/03/blog-post.html

    回覆刪除
  17. https://shenzhenxuan.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  18. https://willie-lai611.blogspot.com/2024/03/blog-post.html

    回覆刪除
  19. https://naiyuanzhang1226.blogspot.com/2024/03/blog-post.html

    回覆刪除
  20. https://su-you-an.blogspot.com/2024/03/blog-post_15.html

    回覆刪除
  21. https://wnagenqiiiiiiiiiiii.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  22. https://linchinppei.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  23. https://li1007.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  24. https://zzl1102.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  25. https://chan-wan-yi.blogspot.com/2024/03/blog-post.html

    回覆刪除
  26. https://giinasmile.blogspot.com/2024/03/pythonutf8.html

    回覆刪除
  27. https://linziwei0308.blogspot.com/2024/03/blog-post_21.html

    回覆刪除
  28. https://wuhongbing.blogspot.com/2024/06/blog-post.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

劉任昌python串列List(陣列Array),元組Tuple,集合Set,字典Dict

2025年3月4日上課Python 陣列array串列的函數(方法)

劉任昌Javascript物件導向Python物件導向