As mentioned by @cardamom, linux command lscpu
returns a lot of interesting information.
Note that their is an option (-J
, --json
) to get the output in the JSON format.
This make it much easier to parse in python.
import json
import subprocess
cpu_info = json.loads(subprocess.check_output("lscpu -J", shell=True))