python - python中的多行输入
问题描述
我希望能够添加多个输入,并且我很确定我需要为此创建一个循环,但不确定如何打印输出的多个副本。
任何帮助,将不胜感激!
mac_hex = input("Enter AP Ethernet Mac Address:")
mac_dec = int(mac_hex, 16)
print (" ")
print ("The Ethernet MAC address is " + (mac_hex))
print (" ")
print ("2.4 Ghz Radio MAC Addresses are as follows")
print ("Radio #1 = " + (hex(mac_dec+35)[2:]))
print ("Radio #2 = " + (hex(mac_dec+45)[2:]))
enter code here
解决方案
while True:
mac_hex = input("Enter AP Ethernet Mac Address, leave empty to exit:")
if not mac_hex.strip():
break
mac_dec = int(mac_hex, 16)
print (" ")
print ("The Ethernet MAC address is " + (mac_hex))
print (" ")
print ("2.4 Ghz Radio MAC Addresses are as follows")
print ("Radio #1 = " + (hex(mac_dec+35)[2:]))
print ("Radio #2 = " + (hex(mac_dec+45)[2:]))
推荐阅读
- java - 将作业静默返回队列
- android - 如何在xamarin跨平台表单c#中一个接一个地播放多个视频
- javascript - 如何在 p5.js 中链接外部 .otf 文件
- python - MLWIC:使用 Python 进行 R 问题中野生动物图像分类的机器学习
- python - 如何在不使用 python 中的 find() 的情况下在字符串中查找索引
- javascript - Next.js 在服务器端设置初始道具时挂起
- regex - 在 Scala 中获取正则表达式匹配的索引
- javascript - highcharts以模态打开重复地图
- java - 如何将消息从后端(java)发送到前端(反应)
- sml - 在不使用 if-else 语句的情况下实现函数