Last active
April 28, 2020 13:50
-
-
Save emilgaripov/ee95d08387986e17db09dac20dd3bf1d to your computer and use it in GitHub Desktop.
Parentheses in lines
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
''' | |
Задание 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' | |
line1 = command1.strip().split()[-1].split(',' | |
) | |
line2 = command2.strip().split()[-1].split(',') | |
vlans = set(line1 + line2) | |
vlans = sorted(list(vlans)) | |
print(vlans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment