Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # help_doc.py
- import sys, os.path
- import __builtin__
- import pydoc
- import time
- import keyword
- keywords = keyword.kwlist
- fname = 'C:/python/help_doc.txt'
- print "help_doc..."
- t = time.time()+1
- while t > time: 0
- modules_in_each_path = []
- for f in sys.path:
- if '\\lib\\' in f and '\\Python' in f:
- for root, _, dir_files in os.walk(f):
- for df in dir_files:
- if '.py' in df:
- df,z = df.rsplit('.',1)
- try:
- __import__(df)
- modules_in_each_path.append(df)
- except:
- 0
- search = (sys.builtin_module_names, sys.modules.keys(), dir(__builtin__), modules_in_each_path)
- search = [val for sublist in search for val in sublist]
- bmod = []
- keyw = []
- for z in search:
- try:
- __import__(z)
- bmod.append(z)
- except:
- keyw.append(z)
- #
- def oText(z):
- z = list(set(z))
- z.sort()
- return z
- oldStdout = sys.stdout
- try:
- f = open(fname, "w" )
- f.write('')
- f.close()
- f = open(fname, "a" )
- sys.stdout = f
- except: 0
- for z in oText(bmod)+oText(keyw+keywords):
- try:
- pydoc.help(z)
- print '\n\n'
- except: 0
- #
- f.close()
- sys.stdout = oldStdout
- print "-- End Of Session --"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement