python-2.7 - 如何在 python 2.7 中重新启动 python?
问题描述
这是代码:
def restartSim():
"""Restarts the current program.
Note: this function does not return. Any cleanup action (like
saving data) must be done before calling this function."""
python = sys.executable
os.execl(python, python, * sys.argv)
这段代码在 python 3.6 但在 python 2.7 中可以正常工作。
如何在 python 2.7 中重新启动?
解决方案
推荐阅读
- ios - 通过更改分支切换 api url
- python - 为什么我从 CSV 文件读取的列长度错误,python
- delphi - Bug in TIdIMAP4.ListMailBoxes?
- java - 分号实际上是做什么的?
- javascript - 如果选中复选框,则导入上一年的主题
- flutter - 文本溢出省略号在末尾添加未知字符
- ios - SwiftUI 在 NavigationViewStyles 之间切换
- c# - 在递归函数调用中获取 System.StackOverflowException ?
- python - Python:将列数整合到一个变量中
- oracle - 如何通过 fichier dmp 重建整体基础 oracle 10g