python help文档输出到文本中(重定向输出)
有时候,想查个对象的帮助,但是内容太多了,一直按回车。。。。。
搜到高手修改系统重定向的代码了,果然可行。。。。
import os
import sys
out = sys.stdout
sys.stdout = open("help.txt", "w")
help(os)
sys.stdout.close()
sys.stdout = out
有时候,想查个对象的帮助,但是内容太多了,一直按回车。。。。。
搜到高手修改系统重定向的代码了,果然可行。。。。
import os
import sys
out = sys.stdout
sys.stdout = open("help.txt", "w")
help(os)
sys.stdout.close()
sys.stdout = out