1.命令行方式:
1 python -c "import sys; help(sys.exit)" > help.txt
2.函数代码的方式输出
1 def help_output(help_element): 2 filename = ‘help.txt‘ 3 4 stdout = sys.stdout 5 out_file = open(filename, ‘w+‘) 6 sys.stdout = out_file 7 8 help(help_element) 9 out_file.flush() 10 11 out_file.close() 12 sys.stdout = stdout
时间: 2024-10-28 21:38:13