summaryrefslogtreecommitdiff
path: root/misc/mapIt.py
blob: 9140b469b3eaefdd42924e9ac133657d303c0c2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!python

# Chapter 11 Example
# mapIT.py - Launches a map in the browser using an address from the command
# line or clipboard.

import webbrowser
import sys
import pyperclip

if len(sys.argv) > 1:
    # Get address from command line
    address = ' '.join(sys.argv[1:])
else:
    #Get address from clipboard
    address = pyperclip.paste()

webbrowser.open('https://www.google.com/maps/place/' + address)