- 网络自动化运维教程
- 梁广民 王金周等主编
- 263字
- 2025-02-17 19:40:39
1.6 知识巩固
1.从下面的配置字符串中获取VLAN列表["1","3","10","20","30","100"],将结果列表写入结果变量。使用print()将结果列表输出到标准输出(stdout)。

2.vlans列表是从网络上所有设备收集的VLAN的列表,因此该列表中有重复的VLAN编号。从vlans列表中获取唯一VLAN编号的新列表,按编号升序排列。要获得最终列表,不能手动删除特定的VLAN。将结果列表写入结果变量,并使用print()将结果列表输出到标准输出(stdout)。

3.mac列表包含格式为XXXX:XXXX:XXXX的MAC地址。但是,在华为设备中,MAC地址的格式为XXXX-XXXX-XXXX。编写代码,将MAC地址转换为华为设备中的格式并将它们添加到名为result的新列表中。使用print()将结果列表输出到标准输出。
