小编fra*_*e09的帖子

我不能支持unicode字符串serialport.write("\ x23o0\x23f")

我们在使用以下代码时遇到了困难

#Get the heading from the IMU
#Translate the IMU from magnetic north to true north since the calcs use true north
def getcurheading():
# The escape character for # is \x23 in hex
    serialport.write("\x23o0 \x23f")
    headresponse = serialport.readline()
#   print(headresponse)
    words = headresponse.split(",")
    if len(words) > 2:
        try:
            curheading = (float(words[0])) + 180
            if curheading + Declination > 360: curheading = curheading - 360 + Declination
            else: curheading = curheading + Declination
        except:
            curheading = 999
#   print(curheading)
        return …
Run Code Online (Sandbox Code Playgroud)

unicode python-3.x

4
推荐指数
1
解决办法
8826
查看次数

标签 统计

python-3.x ×1

unicode ×1