Python搜索附近的WiFi信号

import pywifi
from pywifi import const

def scan_wifi():
    wifi = pywifi.PyWiFi()
    iface = wifi.interfaces()[0]

    iface.scan()
    scan_results = iface.scan_results()
    for result in scan_results:
        print(f"SSID: {result.ssid}, Signal Strength: {result.signal}")

scan_wifi()