Advertisement
mengyuxin

meng.mapIt.py

Jan 3rd, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #! python3
  2. # mapIt.py - Launches a map in the browser using an address from the command line or clipboard.
  3. import webbrowser
  4. import sys
  5. import pyperclip
  6.  
  7. if len(sys.argv) > 1:
  8.     # get address from command line.
  9.     address = ' '.join(sys.argv[1:])
  10. else:
  11.     # get address from clipboard.
  12.     address = pyperclip.paste()
  13.  
  14. if address == '':
  15.     webbrowser.open('http://map.baidu.com/')
  16. else:
  17.     webbrowser.open('http://map.baidu.com/?s=con%26from%3Dalamap%26tpl%3Dmapcity%26wd%3D' + address + '%26c%3D167')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement