无法使用while循环获取所有消息

问题描述

我想从调制解调器获取所有消息 一一使用while循环,但它不起作用。 我的代码有什么问题。

def readInBox():
try:
    inBoxempty = False
    while inBoxempty == False:
        msg = WriteCMDwith_sleep("AT+CPMS?\r",2)
        smschk = CleanData(msg)
        smschk = smschk.split('SM',maxsplit=1)[-1]\
            .split(maxsplit=1)[0]
        if smschk > "0":
            balmsg = WriteCMDwith_sleep('AT+CMGL="ALL"\r',2)
            cleanRdata = CleanData(balmsg)
            parseAll = cleanRdata.split("+CMGL:")
            parsemsg = parseAll[1]
            smsIndex = parsemsg.partition(' ')[0]
            if (insert_message(parsemsg) == True):
                WriteCMDwith_sleep("AT+CMGD="+smsIndex+"\r",2)
        else:
            inBoxempty = True
            break
except Exception as e:
    print(e)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)