问题
I'm looking to see if there is a way to connect or disconnect to a wireless network in python, preferably a way that would work for both public and secured networks if I supplied the password. If I can configure the options about wireless, that would be an added bonus (ex. see all networks in range, see information about networks in range (like encryption type)). I run a windows computer, so I see many answers to this question in Linux, or other operating systems, but none in windows. Thanks in advance.
回答1:
You'll probably have to use one of the DLLs in windows for that. Using ctypes you can get access to the win32 API from Python.
It looks like the functions from wlanapi.dll, starting with WlanOpenHandle and WlanEnumInterfaces might do what you want.
Edit: For example code, see the accepted answer to this.
来源:https://stackoverflow.com/questions/12126744/how-do-i-connect-disconnect-configure-a-wireless-network-in-python