7. Working with files#
In real life, in order to make full use of everything covered before this section you need to understand how to work with files.
When working with network equipment (and not only), files can be:
configurations (simple, non-structured text files)
They are discussed in this section
configuration templates
usually a special file format.
section Jinja configuration temlates discusses the use of Jinja2 to create configuration templates
files with connection options
usually they are structured files in some particular format: YAML, JSON, CSV
section Data serialization discusses how to handle such files
other Python scripts
section Modules discusses how to work with modules (other Python scripts)
This section covers simple text files. For example, Cisco configuration file.
There are several aspects to working with files:
opening/closing
reading
writing
This section covers only the minimum required for working with files. More in Python documentation.