【发布时间】:2019-04-24 04:57:02
【问题描述】:
我有一个 python 脚本,它使用 shell 命令来检索可用接口的数量。我想知道如何使用python库来统计接口的数量。
这是我目前用来计算可用接口数量的代码部分: numberOfInterfaces = int(os.popen('ls -A /sys/class/net | wc -l').read())
【问题讨论】:
-
这里怎么定义接口?您是指网络接口吗?
-
是的。我的意思是网络接口@DeveshKumarSingh
-
只是edit 你的问题来澄清你的意思是什么接口。作为新用户,也可以使用tour 并阅读How to Ask。
标签: python python-3.x python-2.7