需要安装蓝牙模块:pybluez

sudo pip install pybluez

代码

#!/usr/bin/env python
#--*--coding=utf-8--*--
#P191
#sudo pip install pybluez

import time
from bluetooth import *
alreadyFound = []
def findDevs():
	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)

while True:
	findDevs()
	time.sleep(5)

 

python绝技 — 搜寻蓝牙设备

 

  

相关文章:

  • 2021-11-17
  • 2022-02-06
  • 2021-05-23
  • 2022-01-06
  • 2021-12-04
  • 2021-08-10
  • 2021-06-19
  • 2021-11-19
猜你喜欢
  • 2021-12-22
  • 2022-12-23
  • 2022-01-23
  • 2022-02-19
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案