Python pickle 的首选(或最常见)文件扩展名

Preferred (or most common) file extension for a Python pickle

有时,我看到 .pickle.pck.pcl.db 文件包含 Python 泡菜,但我不确定什么是最常见或最佳实践。我知道后三个扩展也用于其他事情。

相关问题是:使用 REST API 在系统之间发送 pickle 时首选哪种 MIME 类型?

Python 2

Python 2 documentation 开始,在序列化(即写入 pickle 文件)时,使用:

output = open('data.pkl', 'wb')

使用 Python 时我会选择 .pkl 作为扩展名 2.

Python 3

Python 3 documentation中的示例现在使用.pickle作为序列化的文件扩展名:

with open('data.pickle', 'wb') as f:
    pickle.dump(...)

从下面 发送 pickle 的首选 MIME 类型:

application/octet-stream