if k == 'packets output' or 'bytes'
This will always evaluate to true
as 'bytes'
is a truthy value, you need to compare k
to both:
if k == 'packets output' or k == 'bytes'
Or more pythonically:
if k in ['packets output', 'bytes']
if k == 'packets output' or 'bytes'
This will always evaluate to true
as 'bytes'
is a truthy value, you need to compare k
to both:
if k == 'packets output' or k == 'bytes'
Or more pythonically:
if k in ['packets output', 'bytes']