我通過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