2014-03-01 61 views
0
import bluetooth 
a=discover_devices() 
if '24:0A:64:XX:XX:XX' in a: 
    print "xyz is here" 
else: 
    print "xyz just went" 

设备正在发现,所以当我试图访问它的一个提示每当设备接通BT或关闭,错误显示。 找不到discover_devices。 怎么办? Plz帮助!蟒蓝牙表示错误

回答

0

您只导入模块;调用discover_devices()函数:

import bluetooth 

a = bluetooth.discover_devices() 

或导入discover_devices名称插入模块:

from bluetooth import discover_devices 

a = discover_devices()