#1.命令行方式:
python -c "import sys; help(sys.exit)" > help.txt
#2.函数代码的方式输出
def help_output(help_element):
filename = 'help.txt'
stdout = sys.stdout
out_file = open(filename, 'w+')
sys.stdout = out_file
help(help_element)
out_file.flush()
out_file.close()
sys.stdout = stdout
python 输出结果到txt_输出python的help结果到文件中
最新推荐文章于 2024-07-20 02:19:51 发布