Last active
September 3, 2020 02:35
-
-
Save emilgaripov/052d45084d46aed791897ede77ee067a to your computer and use it in GitHub Desktop.
vlans.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
Задание 4.5 | |
Из строк command1 и command2 получить список VLANов, | |
которые есть и в команде command1 и в команде command2. | |
Результатом должен быть список: ['1', '3', '8'] | |
Ограничение: Все задания надо выполнять используя только пройденные темы. | |
''' | |
command1 = 'switchport trunk allowed vlan 1,2,3,5,8' | |
command2 = 'switchport trunk allowed vlan 1,3,8,9' | |
command1 = command1.strip().split() | |
command1 = command1[-1].split(',') | |
command2 = command2.strip().split() | |
command2 = command2[-1].split(',') | |
vlans = sorted(list(set(comand1 + command2))) | |
print(vlans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment