如何让Python知道用户连接了哪些Wifi?


问题内容

我14岁,请原谅我的Python知识。我正在尝试使用以下if / else语句使该程序仅在我在学校(在学校的Wifi上)时才能运行:

if ontheschoolwifi:
     Keep running the program
else:
     close the program because im not at school and wont need it

我想知道如何让python知道如何获取它所连接的wifi。预先感谢您的帮助 :)


问题答案:
import subprocess

if "SchoolWifiName" in subprocess.check_output("netsh wlan show interfaces"):
    print "I am on school wifi!"