Learning paths › Automation › Files, CSV, JSON and pickle
Files, CSV, JSON and pickle
Worked file assignments and then the first SSH session: a colon-delimited device file solved with splitlines and solved again with csv.reader, a table round-tripped, Python objects persisted with pickle, dump, dumps, load and loads kept straight, an API body decoded only after its status is checked, and nested records flattened to CSV — then the lab is set up and Paramiko connects, with host-key checking separated from user login. Explanation and checks; three written exercises.
Lessons
- Assignment: parse a colon-delimited device file
- Solve it with splitlines and split
- Solve it again with csv.reader
- Work thirteen text-file challenges
- Round-trip a people table through CSV
- Store a dictionary without losing its structure
- Persist Python objects with pickle
- Write an object, close, read it back
- Write JSON to a file or a string
- Load JSON back into dicts and lists
- Keep dump, dumps, load and loads straight
- Assignment: filter completed records from an API
- Check the status, then decode the body
- Challenge: one helper for JSON and pickle
- Branch on format and match the file mode
- Challenge: flatten nested user records to CSV
- Let the CSV writer quote the coordinates
- Set up one router and a Linux SSH target
- Pick a Paramiko version your old gear accepts
- Paramiko: SSH to network hardware from Python
- Turn on the SSH server on a Cisco device
- Separate host-key checking from user login
- Pass a device dictionary straight into connect
- Open an interactive shell and send a command
More in Automation
- First scripts that configure devices
- NAPALM: structured data across vendors
- Concurrency, and the Python types device output returns
- Parsing show output and testing conditions
- Readable code, branching and loops
- Build the workstation and the toolchain
- Paramiko: SSH to devices from Python
- Netmiko at fleet scale
- Tuples, sets and dictionaries for device records
- Exceptions and your first classes
- Plan and build the automation lab
- Files, formatting and regular expressions
- Addresses, functions, modules and classes
- CSV inventories, logging and scheduling
- Netmiko, SCP and structured parsing
- Agents, async and model-driven workflows
- NETCONF, YANG and RESTCONF
- NX-API, pyATS and Genie
- A small GenAI app, end to end
- macOS, Linux and the virtual lab
- Agile delivery and Python fundamentals
- REST APIs, authentication and requests
- Flask, Docker and Jenkins
- Managing a router with NETCONF and RESTCONF
- Ansible: inventory, ad-hoc commands and first playbooks
- Roles and zero-touch provisioning for Linux switches
- Installing the controller and applying a project
- Setting up Python 3
- The Ansible lab and the controller
- Vault, variables and config changes
- Parsing output and knowing which variable wins
- Jinja filters and PAN-OS automation
- Loops, callbacks, strategy and run control
- Roles, imports and writing your own module
- Running playbooks from AWX