Whats a more pythony way to do this? I have a dict with a few dozen
elements, and I want to pull a few out. I've already shortened it with
itemgetter, but it still seems redundant. I feel like I can do something
like I've seen with *kwargs, but I'm not sure.
I'm using old style sprintf formatting, so feel free to show me a better
way to do this with the new way.
Thanks for the help!
Code:
print(("overall_status=%s|" +
"mon_count=%s," +
"healthy_mons=%s," +
"pg_count=%s," +
"pg_clean_count=%s," +
"osd_count=%s," +
"osd_up=%s," +
"osd_in=%s," +
"bytes_avail=%s," +
"bytes_used=%s," +
"bytes_total=%s") %
itemgetter("overall_status",
"mon_count",
"healthy_mons",
"pg_count",
"pg_clean_count",
"osd_count",
"osd_up",
"osd_in",
"bytes_avail",
"bytes_used",
"bytes_total")(parsed_json))
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor