iT邦幫忙

2025 iThome 鐵人賽

0
自我挑戰組

Python 函式大全系列 第 39

Python 模組概說 《 json 模組 》

  • 分享至 

  • xImage
  •  

✦ 功能:用於處理輕量級 JSON(JavaScript Object Notation)交換格式資料格式的資料,廣泛用於 Web 應用、API 和資料儲存

✦ 屬性與方法 :

json.dumps(obj)

說明:將 Python 物件轉換為 JSON 格式的字串

json.loads(s)

說明:將 JSON 字串解析回 Python 物件(通常是字典或列表)

json.dump(obj, fp)

說明:將 Python 物件直接序列化並寫入到檔案流 (fp) 中

itjson.load(fp)

說明:從檔案流 (fp) 中讀取 JSON 資料並反序列化為 Python 物件

https://ithelp.ithome.com.tw/upload/images/20251017/20177993wl6JmJnkPN.jpg


上一篇
Python 模組概說 《 itertools 模組 》
下一篇
Python 模組概說 《 keyword 模組 》
系列文
Python 函式大全46
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言