Quantcast
Channel: print dictionary minus two elements - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Nick is tired for print dictionary minus two elements

$
0
0
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']

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>