Print Dictionary Minus Two Elements
Python 3.6 All debug output is from PyCharm 2017.1.2 I have a program that gets to this portion of the code: if len(errdict) == 21: for k, v in errdict.items(): if k ==
Solution 1:
ifk== 'packets output' or 'bytes'This will always evaluate to true as 'bytes' is a truthy value, you need to compare k to both:
ifk== 'packets output'ork== 'bytes'Or more pythonically:
if k in ['packets output', 'bytes']Solution 2:
iflen(errdict) == 21:
for k, v in errdict.items():
ifk== 'packets output'ork== 'bytes':
continueprint(k, v)
print()
Post a Comment for "Print Dictionary Minus Two Elements"