Skip to content

Instantly share code, notes, and snippets.

@perrygeo
Created March 10, 2017 14:52
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 perrygeo/b8b6d2bd6ce305bec653f6f9906fe0e9 to your computer and use it in GitHub Desktop.
Save perrygeo/b8b6d2bd6ce305bec653f6f9906fe0e9 to your computer and use it in GitHub Desktop.
help() is not helpful. let me google that for you
# LMGTFY
# For best results, have python autoload it
# add to $(sitepackages)/sitecustomize.py
# alias sitepackages="python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'"
import webbrowser
from urllib2 import quote
def lmgtfy(x):
search = "Python {}".format(x.__name__)
url = 'https://www.google.com/?q=' + quote(search.encode('utf-8'))
webbrowser.open_new(url)
__builtins__['help'] = lmgtfy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment