#coding:utf-8 import subprocess def run_shell_command(command_str): proc = subprocess.run(command_str, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) result = proc.stdout.split("=") return result[1].replace('\'C\n', '') temp = run_shell_command("vcgencmd measure_temp") print(temp)