如何在Python中使用for循环打印30个mac地址 [英] How to print 30 mac addresses using for loop in Python
本文介绍了如何在Python中使用for循环打印30个mac地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最初尝试使用5个数字
我尝试过:
mac_list =aa:bb:cc:dd:
for i in range(0,5,1):
for j in range(0,5) ,1):
print(aa:bb:cc:dd:+
如何追加数字(即i, j)到mac地址例如 - aa:bb:cc:dd:01
解决方案
mac_list = aa:bb:cc:dd:
for 范围内( 0 , 5 ):
j 范围内( 0 , 5 ):
print (mac_list,i,j,sep = ' ')
参见:< a href =https://docs.python.org/3/tutorial/inputoutput.html> 7。输入和输出 - Python 3.6.3文档 [ ^ ]。
Intially trying with 5 numbers
What I have tried:
mac_list ="aa:bb:cc:dd:"
for i in range (0,5,1):
for j in range(0,5,1):
print("aa:bb:cc:dd:+
stuck how to append the num(i.e i,j) to the mac address eg - aa:bb:cc:dd:01
解决方案
mac_list ="aa:bb:cc:dd:" for i in range(0,5): for j in range(0,5): print(mac_list,i,j, sep='')
See also: 7. Input and Output — Python 3.6.3 documentation[^].
这篇关于如何在Python中使用for循环打印30个mac地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文