Patrick Denis > 2020 > August
Monthly Archive: August 2020
admin
August 4, 2020
To work with data structure you can drill down to which information you need using these commands to peel it layer by layer : 1st determine what kind of data : List : output.keys() type(output) len(output) Then to see the…
Read more
admin
August 3, 2020
To import a library in python you need to specify it in the beginning of the script file : import “library” example pprint is a library for an easy reading output. to see where that library is install : “library”.__file__…
Read more
admin
August 3, 2020
Hey Ben ! : See below the install Linux and Windows for me details how to : —— LINUX —– Install : apt-get update apt install python3-virtualenv cd ~ cd VENV virtualenv virtualenv-3.6 -p /usr/bin/python36 “virtual env name” ll or…
Read more
admin
August 3, 2020
import sys sys.path Every time you are importing a package “netmiko” this is where it is going to look for it. to remove the default path for python : env | grep PYTH unset PYTHONPATH env | grep PYTH cat…
Read more
admin
August 3, 2020
how to use pip : pip install “package” pip install –upgrade “package” pip install “package”==”version” pip list pip uninstall “package”
admin
August 3, 2020
When dealing with very large output data structure , and need to extract data from it : Example : Devices = { ‘sw1’: { ‘ip_addr’: ‘10.10.10.1’, ‘username’: ‘admin’, ‘password’: ‘cisco’, ‘bgp_peer’: ‘10.10.20.1’, ‘10.10.30.1’, ‘10.10.40.1’}, ‘sw2’: { ‘ip_addr’: ‘10.10.10.2’, ‘username’: ‘admin’,…
Read more
admin
August 3, 2020
You can use JSON to output a dictionary so it is easier to read, personally i prefer the pprint output but as today i didn’t got a chance to see why i would use that. so to be updated soon…
Read more
admin
August 3, 2020
Example of a YAML file : List : — – 10.10.10.1 – 10.10.10.2 – 10.10.10.3 Dictionary : — Key:value device1: 10.10.10.1 device2: this is a string device3: “this can nclude special characters” device4: True or true or yes or no…
Read more