from gsmmodem import pdu
python 解决gsmmodem避免以下错误, 并用代码实现:
EncodingError: decoding with 'hex_codec' codec failed (Error: Odd-length string)
ValueError: time data 'a10033005300' does not match format '%y%m%d%H%M%S'
from gsmmodem import pdu
def decode_pdu(pdu_string):
decoded_pdu = pdu.decodeSmsPdu(pdu_string)
return decoded_pdu
pdu_string = '0891683108200105F02410A001964055802776300008328041015461233830107CFB7EDF9A8C8BC130119A8C8BC17801FF1A0033003500350031003900330020FF0C611F8C2260A84F7F75287F514E0A84254E1A5385'
decoded_pdu = decode_pdu(pdu_string)
print(decoded_pdu)