如何让Python知道用户连接的Wifi? [英] How do I get Python to know what Wifi the user is connected to?
本文介绍了如何让Python知道用户连接的Wifi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我14岁,请原谅我的Python知识.我正在尝试使用以下if/else语句使该程序仅在我在学校(在学校的Wifi上)时才能运行:
I'm 14, pardon my Python knowlege. I'm trying to make this program that will only run while I'm at school (on the school's Wifi) using an if/else statement like this:
if ontheschoolwifi:
Keep running the program
else:
close the program because im not at school and wont need it
我想知道如何让python知道如何获得它所连接的wifi. 预先感谢您的帮助:)
I'd like to know how to let python know how to get what wifi it is connected to. Thank you, in advance, for your help :)
推荐答案
import subprocess
if "SchoolWifiName" in subprocess.check_output("netsh wlan show interfaces"):
print "I am on school wifi!"
这篇关于如何让Python知道用户连接的Wifi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文