Saving and Loading Binary Files

Both PyQt and the Python standard library provide facilities for writing and reading binary files. PyQt uses the QDataStream class, and the Python standard library uses the file class, either directly or in conjunction with the pickle module.

Binary formats are not human-readable, but they are the easiest to code and the fastest to write and read to and from disk. No parsing is necessary: Numbers, dates, and many PyQt types, including images, can be read and written without formality. PyQt's support for binary files is very strong: PyQt ensures that binary files are platform-independent, and it isn't difficult to version our binary file types so that we can extend our file format when required. The Python standard library's pickle module (and its faster cPickle counterpart) also provide fast platform-independent loading and saving, but may not be as efficient as PyQt's QDataStream for handling complex PyQt types, such as images.

Was this article helpful?

0 -1
100 SEO Tips and More

100 SEO Tips and More

100 SEO Tips EVERY SEO Enthusiast Should Know. This Report 100 SEO Tips will help you to Utilize These Tips to Dominate The Search Engine Today.

Get My Free Ebook

Post a comment