1.安装pywifi模块
pywifi依赖comtypes,不安装会报错
pip install pywifi
pip install comtypes
2.代码
import pywifi
from pywifi import const
import time
def is_connected(wifi_inter):
if wifi_inter.status() in [const.IFACE_CONNECTED, const.IFACE_INACTIVE]:
return True
else:
return False
def connet_wifi(wifi_inter