我在Windows上安装了Python 2.7和3.3,在Linux上安装了Python 2.7和3.2mu。如何使用2.X或3.X版本编写可在Windows和Linux上使用的Python脚本?我正在寻找几行代码,以检查当前的操作系统是什么,并在脚本的其余部分使用Python 3.X在其所在的任何目录中。我在思考以下方面:if operating_system == Windows: run rest of script with C:\python_directory3.X\pythonelif operating_system == Linux: run rest of script with /usr/bin/python3.X是否存在这样的代码,还是我必须为两个操作系统制作不同的脚本?
添加回答
举报
0/150
提交
取消