【发布时间】:2015-08-10 23:33:03
【问题描述】:
我正在通过 COM 端口与调制解调器通信以接收 CSQ 值。
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: ''
【问题讨论】:
-
不要忘记将答案标记为正确,以帮助将来查看此问题的人!
标签: python string python-2.7 converter