cam*_*odi 1 python console customization command-line-interface
通常Python控制台看起来像这样:
>>> command
Run Code Online (Sandbox Code Playgroud)
有没有办法让它看起来像:
SomeText>>> command
Run Code Online (Sandbox Code Playgroud)
sys.ps1 == ">>>"
sys.ps2 == "..."
Run Code Online (Sandbox Code Playgroud)
您也可以在PYTHONSTARTUP环境变量中更改此设置.
例如(这不安全),将以下内容放在脚本中,并将PYTHONSTARTUP设置为指向该脚本.
import sys
import getpass
sys.ps1 = getpass.getuser( ) + ">>> "
Run Code Online (Sandbox Code Playgroud)
当然,您可以将上面的最后一行更改为您想要的任何内容.
| 归档时间: |
|
| 查看次数: |
140 次 |
| 最近记录: |