I use list comprehension for simple loops. But I could't use list comprehension for the following code. How can I do it?
import psutil
list1 = []
for pr in psutil.process_iter():
with pr.oneshot():
list1.append([pr.name(), pr.status()])
Python 3.8