2014-03-01 77 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()