Skip to content

Instantly share code, notes, and snippets.

@SamuelMarks
Forked from ekimekim/pyman
Last active January 2, 2016 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamuelMarks/8249092 to your computer and use it in GitHub Desktop.
Save SamuelMarks/8249092 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from sys import argv, exit
if __name__ == '__main__':
if len(argv) < 2:
print "USAGE: {0} MODULE [SYMBOL]".format(argv[0])
print "Open help() for given module, or given symbol from module"
exit(1)
module = argv[1] if argv[1] != '.' else ''
symbol = argv[2] if len(argv) > 2 else ''
if module:
exec 'import {0}'.format(module)
exec 'subject = {0}'.format(".".join((module, symbol)).strip('.'))
help(subject)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment