Contents Menu Expand Light mode Dark mode Auto light/dark mode
Python for network engineers
Python for network engineers
  • Download PDF/Epub
  • Introduction
    • About book
    • Frequently Asked Questions (FAQ)
    • Acknowledgments
  • Book resources
  • I. Python basics
    • 1. Preparing for work
      • Working environment
      • OS and editor
      • Package management system Pip
      • Virtual environment
      • Python interpreter
      • Further reading
      • Exercises
    • 2. Using Git and Github
      • Git fundamentals
      • Displaying repository status in invitation
      • Working with Git
      • Additional features
      • Github authentication
      • Working with own repository
      • Working with repository of tasks and examples
      • Further reading
      • Tasks
    • 3. Getting started with Python
      • Python syntax
      • Python interpreter. IPython
      • IPython special commands
      • Variables
      • Tasks
    • 4. Python data types
      • Numbers
      • Strings
        • String methods
        • String formatting
        • Literal strings concatenation
      • List
        • List methods
      • Dictionary
        • Dictionary methods
        • Dictionary creation options
      • Tuple
      • Set
        • Set methods
        • Operations with sets
        • Options for set creation
      • Boolean values
      • Types conversion
      • Types checking
      • Method chaining
      • Sorting basics
      • Further reading
      • Tasks
    • 5. Basic scripts
      • Executable file
      • Passing arguments to the script (sys.argv)
      • User input
      • Tasks
    • 6. Control structures
      • if/elif/else
      • for
        • Nested for
        • Combination for and if
      • while
      • break, continue, pass
      • for/else, while/else
      • Working with try/except/else/finally
      • Further reading
      • Tasks
    • 7. Working with files
      • File opening
      • File reading
      • File writing
      • File closing
      • with statement
      • Examples of working with files
      • Further reading
      • Tasks
    • 8. Python basic examples
      • Formatting lines with f-strings
      • Variable unpacking
      • List, dict, set comprehensions
      • Further reading
  • II. Code reuse
    • 9. Functions
      • Creation of functions
      • Namespace. Scope of variables
      • Function parameters and arguments
        • Function parameter types
        • Function argument types
        • Variable length arguments
        • Unpacking arguments
      • Example of using variable length keyword arguments and unpacking arguments
      • Further reading
      • Tasks
    • 10. Useful functions
      • print
      • range
      • sorted
      • enumerate
      • zip
      • all
      • any
      • Anonymous function (lambda expression)
      • map
      • filter
    • 11. Modules
      • Module import
      • Create your own modules
      • if __name__ == "__main__"
      • Further reading
      • Tasks
    • 12. Useful modules
      • subprocess
      • os
      • ipaddress
      • tabulate
      • pprint
      • Tasks
    • 13. Iterators, iterable and generators
      • Iterable
      • Iterators
      • Generator
      • Further reading
  • III. Regular expressions
    • 14. Regular expression (regex) syntax
      • Regular expression syntax
      • Character sets
      • Repeating characters
      • Special symbols
      • Greedy qualifiers
      • Grouping
      • Parsing the output of ‘show ip dhcp snooping’ command using named groups
      • Non-capturing group
      • Repeating the captured result
    • 15. Module re
      • Match object
      • Search function
      • Match function
      • Finditer function
      • Findall function
      • Compile function
      • Flags
      • Function re.split
      • Function re.sub
      • Further reading
      • Tasks
  • IV. Data writing and transmission
    • 16. Unicode
      • Unicode standard
      • Unicode in Python 3
      • Conversion between bytes and strings
      • Examples of converting between bytes and strings
      • Converting errors
      • Further reading
    • 17. Working with CSV, JSON, YAML files
      • Work with CSV files
      • Work with JSON files
      • Work with YAML files
      • Further reading
      • Tasks
  • V. Working with network devices
    • 18. Connection to network devices
      • Password input
      • Module pexpect
      • Example of pexpect use
      • Module telnetlib
      • Module paramiko
      • Module netmiko
      • Module scrapli
      • Further reading
      • Tasks
    • 19. Concurent connections to multiple devices
      • Measure script execution time
      • Processes and threads in Python (CPython)
      • Number of threads
      • Thread safety
      • Module logging
      • Module concurrent.futures
        • Method map
        • Method submit and work with futures
        • Using ProcessPoolExecutor
      • Further reading
      • Tasks
    • 20. Jinja2 configuration templates
      • Getting started with Jinja2
      • Example of using Jinja
      • Jinja2 template syntax
        • Control of whitespace symbols
        • Variables
        • Loop for
        • if/elif/else
        • Filters
        • Tests
        • set
        • include
      • Template inheritance
      • Further reading
      • Tasks
    • 21. Parsing command output with TextFSM
      • Getting started with TextFSM
      • TextFSM template syntax
      • State rules
      • Examples of TextFSM usage
      • TextFSM CLI Table
      • Further reading
      • Tasks
  • VI. Basics of object-oriented programming
    • 22. OOP basics
      • OOP basics
      • Class creation
      • Method creation
      • Parameter self
      • Method __init__
      • Class example
      • Class namespace
      • Class variables
      • Tasks
    • 23. Special methods
      • Underscore in names
      • Methods __str__, __repr__
      • Arithmetic operator support
      • Protocols
        • Iteration protocol
        • Sequence protocol
        • Context manager
      • Tasks
    • 24. Inheritance
      • Inheritance basics
      • Tasks
  • VII. Working with databases
    • 25. Database operations
      • SQL
      • SQLite
      • SQL basics (in sqlite3 CLI)
        • CREATE
        • DROP
        • INSERT
        • SELECT
        • WHERE
        • ALTER
        • UPDATE
        • REPLACE
        • DELETE
        • ORDER BY
        • AND
        • OR
        • IN
        • NOT
      • Sqlite3 module
        • Executing SQL commands
        • Fetching query results
        • Cursor as iterator
        • Using sqlite3 module without explicit cursor creation
        • Exception Handling
        • Connection as context manager
        • SQLite use example
      • Further reading
      • Tasks
  • VIII. Additional information
    • Testing tasks with the pyneng utility
    • Tasks checking with tests
      • Pytest basics
      • Specifics of using pytest to check tasks
    • argparse
    • String formatting with % operator
    • Naming convention
    • Underscore in names
    • Python 2.7 and Python 3.6 distinctions
    • Preparing Windows
    • Preparing Linux
  • What’s next

Links

  • Examples and tasks
  • Answers
  • Ask a Question
  v: latest
Versions
latest
Downloads
pdf
epub
On Read the Docs
Project Home
Builds
Back to top

Download PDF/Epub#

  • Epub

  • PDF

Next
Introduction
Previous
Home
Copyright © 2015-2022, Natasha Samoylenko
Made with Sphinx and @pradyunsg's Furo
Last updated on Sep 29, 2022