prompt
= '请输入内容:'
line
= input(prompt
)
print(f
'{ line = } { type(line) = }')
print(prompt
, end
='')
line
= input()
print(f
'{ line = } { type(line) = }')
while True:
line
= input()
print(f
'{ line = }')
while True:
try:
line
= input()
print(f
'{ line = }')
except EOFError
:
break
import readline
history_filepath
= 'history.txt'
while True:
line
= input('请输入内容:')
print(f
'{ line = }')
readline
.write_history_file
(history_filepath
)
import sys
def audit_hook(event
, args
):
if event
in ['builtins.input', 'builtins.input/result']:
print(f
'{ event = } { args = }')
sys
.addaudithook
(audit_hook
)
line
= input('请输入内容:')
print(f
'{ line = }')
代码来自周华健的网课 - 《轻松学习Python 69个内置函数》 https://edu.csdn.net/course/play/31010/459524?spm=1002.2001.3001.4143