python蓝牙模块
需要安装蓝牙模块:pybluez #pip install pybluez import time from bluetooth import * alreadyFound = [] def findDevs(): print("start searching...") foundDevs = discover_devices(lookup_names=True) for(addr,name) in foundDevs: if addr not in alreadyFound: print("[*] Found Bluetooth Device : " +str(name)) print("[+] MAC address : " +str(addr)) alreadyFound.append(addr) findDevs() import bluetooth print("performing inquiry...") nearby_devices = bluetooth.discover_devices(lookup_names = True) print("found %d devices" % len(nearby_devices)) for addr, name in nearby_devices: print(" %s - %s" % (addr, name)) 参考: