Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Python Programming

You're reading from   Learn Python Programming A comprehensive, up-to-date, and definitive guide to learning Python

Arrow left icon
Product type Paperback
Published in Nov 2024
Publisher Packt
ISBN-13 9781835882948
Length 616 pages
Edition 4th Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Heinrich Kruger Heinrich Kruger
Author Profile Icon Heinrich Kruger
Heinrich Kruger
Fabrizio Romano Fabrizio Romano
Author Profile Icon Fabrizio Romano
Fabrizio Romano
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Learn Python Programming, Fourth Edition: A Comprehensive, Up-to-Date, and Definitive Guide to Learning Python FREE CHAPTER
1 A Gentle Introduction to Python 2 Built-In Data Types 3 Conditionals and Iteration 4 Functions, the Building Blocks of Code 5 Comprehensions and Generators 6 OOP, Decorators, and Iterators 7 Exceptions and Context Managers 8 Files and Data Persistence 9 Cryptography and Tokens 10 Testing

Summary

In this chapter, we explored working with files and directories. We learned how to read and write on files, and how to do that elegantly by using context managers. We also explored directories: how to list their content, both recursively and not. We also learned about paths, which are the gateway to accessing both files and directories.

We then briefly saw how to create a ZIP archive and extract its content. The source code of the book also contains an example with a different compression format: tar.gz.

We talked about data interchange formats and have explored JSON in some depth. We had some fun writing custom encoders and decoders for specific Python data types.

Then we explored I/O, both with in-memory streams and HTTP requests.

We saw how to persist data using pickle, shelve, and the SQLAlchemy ORM library.

And finally, we explored two example of configuration files, using the INI and TOML formats.

You should now have a good understanding of how to deal with files and data...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime