Libraries for different types of files
Besides simple text files, Python provides different libraries for handling specific types of files
csv
– reading from and writing to Comma Separated Values (CSV) filesjson
– encoding and decoding JavaScript Object Notation (JSON) dataxml.etree.ElementTree
- creating and reading XML fileswave
andaifc
– reading from and writing to audio filestarfile
– reading and writing tar archive fileszipfile
– working with ZIP archivesconfigparser
– creating and parsing configuration files
There are also third party tools for reading and manipulating different files
We will look at two of these in this module: csv
and json
.