gpt4 book ai didi

python - python 和 Sublime text 2 的奇怪错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:44:04 24 4
gpt4 key购买 nike

我正在尝试用Python编写代码来从蓝牙读取数据。这是我到目前为止的代码:

import serial

arduinoData = serial.Serial('com7', 9600)

while True:
while(arduinoData.inWaiting() == 0): # Si no hay datos, se espera
print "There is no data"
pass


arduinoString = arduinoData.readline()
print "This is the Data: "
print arduinoString

在我的第一次尝试中,我遇到了这个错误:

enter image description here

所以我搜索了这个错误,发现了这个: UTF-8 and SublimeText

按照答案所说的进行操作后,这次我得到:

enter image description here

这是什么意思?这是解码错误还是其他类型的错误?

希望你能帮助我。

最佳答案

[SOH] 是 Sublime 使用的 ASCII 0x01 的文本表示,即 Start of Heading控制字符。您的代码没有任何问题 - 这只是通过连接发送的内容。

关于python - python 和 Sublime text 2 的奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36501231/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com