我通过COM端口与调制解调器通信以接收CSQ值。从字符串转换为Int
response = ser.readline()
csq = response[6:8]
print type(csq)
返回如下:
<type 'str'> and csq is a string with a value from 10-20
对于进一步的计算我尝试转换 “CSQ” 成一个整数,但
i=int(csq)
返回以下错误:
invalid literal for int() with base 10: ''
不要忘记标记一个答案是正确的,以帮助那些在未来看到这个问题的人! – Scironic