我想从python
运行此命令/opt/vc/bin/vcgencmd measure_temp
当我在python中运行它时,它会将温度打印到屏幕并返回0.当我尝试将其分配给变量时,它也会分配0。
>>> import os
>>> os.system('/opt/vc/bin/vcgencmd measure_temp')
temp=42.8'C
0
>>> temp=os.system('/opt/vc/bin/vcgencmd measure_temp')
temp=42.8'C
>>> temp
0
>>>
如何在python中运行此命令并将实际温度分配给变量?