Skip to content

Commit efa5ad7

Browse files
committed
mapIt.py v1.0
1 parent 5081ca7 commit efa5ad7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Beautifulsoup_WebScraping/mapIt.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! python3
2+
# mapIt.py - Launches a map in the browser using an address from the
3+
# command line or clipboard.
4+
5+
# Importing all the necessary Libraries.
6+
import webbrowser # Used for opening google maps website
7+
import sys # For Retrirving the address from the commandline
8+
import pyperclip # To Retrieve the address from the clipboard.
9+
10+
# get the address from either the command line or clipboard.
11+
if len(sys.argv) > 1:
12+
# Get address from the command line
13+
## As the sys.argv[0] is the program name
14+
addr = ' '.join(sys.argv[1:])
15+
16+
# Get the address from teh clipboard if the address
17+
# is not passed as an argument in the commandline.
18+
else:
19+
addr = pyperclip.paste()
20+
21+
22+
# pyperclip.copy('870 Valencia St, San Francisco, CA 94110')
23+
# addr = pyperclip.paste()
24+
25+
#
26+
address = addr.replace(',', '').split(' ')
27+
webbrowser.open('https://www.google.com/maps/place/'+ str('+'.join(address)) + '/')

0 commit comments

Comments
 (0)