📜  如何将 python 中的对象保存到磁盘 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:45.541000             🧑  作者: Mango

代码示例1
# Step 1
import pickle
 
config_dictionary = {'remote_hostname': 'google.com', 'remote_port': 80}
 
# Step 2
with open('config.dictionary', 'wb') as config_dictionary_file:
 
  # Step 3
  pickle.dump(config_dictionary, config_dictionary_file)