代码如下:
def get_platform():
import platform
sys_platform = platform.platform().lower()
if "windows" in sys_platform:
print("Windows")
elif "macos" in sys_platform:
print("Mac os")
elif "linux" in sys_platform:
print("Linux")
else:
print("其他系统")
if __name__ == "__main__":
get_platform()