我想制作一个 python 脚本来检查用户的机器外形(笔记本电脑或台式机),然后我就可以使用这样的条件:
chassis_type = some_module.get_chassis_type()
if chassis_type == 'laptop':
print("You are out of luck, because you are using laptop.")
if chassis_type == 'desktop':
print("You are good to go, because you are using desktop.")
我不想检查是否存在电池,但我想使用更通用的方式。有没有办法使用python实现这一点?