在python 2.7中使用蓝牙搜索设备
我是这门语言的初学者,我收到了以下错误消息: 运行文件'C:/Users/Welcome/.xy/startups/one.py',wdir=r'C:/Users/Welcome/.xy/startups'在python 2.7中使用蓝牙搜索设备,python,Python,我是这门语言的初学者,我收到了以下错误消息: 运行文件'C:/Users/Welcome/.xy/startups/one.py',wdir=r'C:/Users/Welcome/.xy/startups' 请帮助我。正如@Ozan Dniz评论的那样,您应该@Karikeswar Das更正最后一行的缩进 import bluetooth print("performing inquiry...") nearby_devices = bluetooth.discover_devices(l
请帮助我。正如@Ozan Dniz评论的那样,您应该@Karikeswar Das更正最后一行的缩进
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))
您的代码应使用纯空格字符进行缩进,而不是使用任何制表符或将它们混合在一起您需要进行正确的缩进。for loop print命令之后必须使用选项卡
for addr, name in nearby_devices:
print(" %s - %s" % ( addr, name ) ) # indented lines "belong" to loop