我记得在Python3.5文档中,我读过如何在Python交互提示符上更改>>>
,例如调用help()
如何将其更改为help>
.
但由于某种原因,当我回go 试着回忆时,我就是找不到它的说明.有人知道这是否可能吗?
我记得在Python3.5文档中,我读过如何在Python交互提示符上更改>>>
,例如调用help()
如何将其更改为help>
.
但由于某种原因,当我回go 试着回忆时,我就是找不到它的说明.有人知道这是否可能吗?
你记得没错.
它位于sys模块(sys.ps1和sys.ps2)中:
Strings specifying the primary and secondary prompt of the interpreter. These are only defined if the interpreter is in interactive mode. Their initial values in this case are '>>> ' and '... '. If a non-string object is assigned to either variable, its str() is re-evaluated each time the interpreter prepares to read a new interactive command; this can be used to implement a dynamic prompt.
例如:
>>> import sys >>> sys.ps1 = "3.5>>> " 3.5>>> sys.ps2 = "3.5... " 3.5>>>