We generally open the browser to search for a specific site/place on google maps. And if you need to do this task multiple times a day, it becomes very boring. Now you can automate this task where your browser will open automatically and the webpage will show you the google maps of your desired location.
For this purpose, I’m going to use the paperclip package. As this is not the standard package, we need to install it using pip.
>pip install pyperclip Collecting pyperclip Downloading https://files.pythonhosted.org/packages/2d/0f/4eda562dffd085945d57c2d9a5da745cfb5228c02bc90f2c74bbac746243/pyperclip-1.7.0.tar.gz Building wheels for collected packages: pyperclip Building wheel for pyperclip (setup.py) ... done Stored in directory: C:\Users\rajesh\AppData\Local\pip\Cache\wheels\92\f0\ac\2ba2972034e98971c3654ece337ac61e546bdeb34ca960dc8c Successfully built pyperclip Installing collected packages: pyperclip Successfully installed pyperclip-1.7.0
Steps to accomplish this:
First read the desired address either from the command line argument or from the clipboard.
Second using the webbrowser module to automatically open default web browser with the desired address.
Require sys module to access the command line stored in argv list.
Lastly use pyperclip module to access from the clipboard.
#webbrowser module helps in open default web browser of os from webbrowser import open #sys contains command line arguments from sys import argv #To access clipbord from pyperclip import paste if len(argv)>1: address = " ".join(argv[1:]) else: address = paste() open("http://www.google.com/maps/place/"+address)