iT邦幫忙

2025 iThome 鐵人賽

0
自我挑戰組

Python 函式大全系列 第 53

Python 模組概說 《 shelve 模組 》

  • 分享至 

  • xImage
  •  

✦ 功能:用於提供持久化儲存機制,允許將物件儲存到檔案中並以類似字典的介面進行存取,適合儲存小型資料集或簡單的應用狀態

✦ 屬性與方法 :

shelve.open()

說明:開啟 shelve 數據庫

shelf.sync()

說明:強制將數據寫入磁盤

shelf.close()

說明:關閉數據庫

shelf.get()

說明:安全獲取值

shelf.setdefault()

說明:設置默認值

shelf.update()

說明:批量更新

shelf.clear()

說明:清空所有數據

https://ithelp.ithome.com.tw/upload/images/20251028/20177993PhzM3292PM.jpg


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

尚未有邦友留言

立即登入留言