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

 



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
猜你喜欢
  • 2021-07-15
  • 2022-12-23
  • 2021-07-07
  • 2022-01-21
  • 2021-12-20
  • 2021-08-03
相关资源
相似解决方案