Из-за периодической блокировки нашего сайта РКН сервисами, просим воспользоваться резервным адресом:
Загрузить через dTub.ru Загрузить через ycliper.com Загрузить через ClipSaver.ruУ нас вы можете посмотреть бесплатно Learn Nested Dictionaries in Python with Netmiko или скачать в максимальном доступном качестве, которое было загружено на ютуб. Для скачивания выберите вариант из формы ниже:
Роботам не доступно скачивание файлов. Если вы считаете что это ошибочное сообщение - попробуйте зайти на сайт через браузер google chrome или mozilla firefox. Если сообщение не исчезает - напишите о проблеме в обратную связь. Спасибо.
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса savevideohd.ru
In this video, we will learn about nested dictionaries in Python. Below is the code I used in the video: A nested dictionary is a dictionary inside another dictionary. Key: A unique and immutable identifier (e.g., a string, number, or tuple). Value: Can be any data type (string, number, list, another dictionary, etc.). Structure: Key-value pairs are separated by a colon (:), and pairs are enclosed within curly braces ({}). Separator: Each key-value pair is separated by a comma (,). from pprint import pprint Initial Nested Dictionary device_data = { # Main dict "Router1": { # Nested dict for "Router1" "hostname": "R1", # Key-value pair "ip": "192.168.1.1", # Key-value pair } # End of nested dict } # End of main dict Create: Add new interface device_data["Router1"]["interfaces"] = { "Gig0/0": {"status": "up", "ip": "192.168.1.2"}, "Gig0/1": {"status": "down", "ip": None}, } Read: Access data print(device_data["Router1"]["hostname"]) print(device_data["Router1"]["interfaces"]["Gig0/0"]["ip"]) Update: Modify existing data device_data["Router1"]["ip"] = "192.168.1.2" device_data["Router1"]["interfaces"]["Gig0/1"]["status"] = "up" Delete: Remove data del device_data["Router1"]["interfaces"]["Gig0/1"] del device_data["Router1"]["ip"] Print final result print(device_data) #python #pythonforbeginners #networkautomation