Python Forum
Getting wanted data from the 'top' command (Linux)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting wanted data from the 'top' command (Linux)
#2
(Nov-08-2018, 09:56 PM)rootVIII Wrote: is there a better way to print the key/value pairs from a generator object?
You can try
from itertools import chain
for k, v in chain.from_iterable(info.items() for info in Top().run_top()):
    print(k)
    print(v)
Reply


Messages In This Thread
RE: Getting wanted data from the 'top' command (Linux) - by Gribouillis - Nov-09-2018, 07:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Command output to pdf (linux) Gribouillis 0 5,010 Mar-05-2021, 07:35 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020