简体   繁体   中英

What are the advantages of .pkl file over .txt or csv file in python

在 Python 中以 .pkl 格式保存文件比以 .txt 或 .csv 格式保存文件有什么优点?

.pkl 可以序列化非常广泛的对象,而不仅仅是文本数据。

Although you only ask about the advantages, I would like to mention the disadvantages first.

Con:

  • Csv file is more popular.
  • pkl might have security problem. see here

Pro:

  1. PKL is faster.

  2. PKL can store any binary subject.

    JSON is a text serialization format (it outputs unicode text, although most of the time it is then encoded to utf-8), while pickle is a binary serialization format;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM