折腾:
【未解决】Win10中上线对接iOS自动抓包工具
期间,看到一个奇怪的现象:

allAccountMarkerDict = findAllMarkerAccountInfo(dataLineList) if not allAccountMarkerDict: logging.error("Fail to parse out all account marker account from data file %s", dateFilePath) return
此时:allAccountMarkerDict不是None,而是有值的:
OrderedDict([('gh_25e1a8597a58/MokuGuitar', 'exception')])
not allAccountMarkerDict 却是True
很是奇怪。
python ordereddict check if none
去加上bool试试?
allAccountMarkerDict = findAllMarkerAccountInfo(dataLineList) isAllMarkerNotEmpty = bool(allAccountMarkerDict) isAllMarkerEmpty = not isAllMarkerNotEmpty # if not allAccountMarkerDict: if isAllMarkerEmpty:
结果:

是可以的。
不过也突然发现:
之前好像就是本身OrderedDict是空的
所以才返回False
然后not False才是True,才导致输出错误信息的。
即:
之前代码:
allAccountMarkerDict = findAllMarkerAccountInfo(dataLineList) if not allAccountMarkerDict:
逻辑本身是对的。没问题的。
所以是自己搞错了。
OrderedDict本身没问题。
后续OrderedDict有值,也就没报错了:

【总结】
此处代码:
allAccountMarkerDict = findAllMarkerAccountInfo(dataLineList) if not allAccountMarkerDict: xxx
是没问题的。是自己的逻辑判断有误。代码没问题。