ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Python String Tips for Network Automation

cisco

ccna

ccnp

ccie

Автор: Ferds Tech Channel

Загружено: 2024-11-05

Просмотров: 46

Описание: In this video I talk about a few Python string tips/techniques you can use for string manipulation and inspection. Below is the code I used in the video:


http://routeviews.org/

from netmiko import ConnectHandler

Define the Cisco device
cisco_device = {
"device_type": "cisco_ios_telnet",
"host": "route-views.routeviews.org",
"username": "rviews",
}

Establish connection
connection = ConnectHandler(**cisco_device)
hostname = connection.find_prompt().strip("#")
output = connection.send_command("show clock")

Using repr() to show raw string with escape sequences
print(repr(output))

Using r"..." to make file paths easier to manage
file_path = r"C:\Users\user\Desktop\ftc\Topics\Python\netmiko\device_output.txt"
with open(file_path, "w") as file:
file.write(hostname + "\n")
file.write(output + "\n")

Using len() to measure string length
print("Hostname length:", len(hostname))
print("Clock output length:", len(output))

Using Escape Sequences to improve output readability
print(f"Hostname: {hostname}\nClock Info:\n{output}\n")

Disconnect the connection
connection.disconnect()

#pythonforbeginners #coding #networkautomation

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Python String Tips for Network Automation

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]