Fork me on GitHub

《编程快速上手》--web抓取--利用webbrowser模块的mapIT.py

1.代码如下

#! python3 
# mapIT.py - Launches a map in the browser using an address from the 
# command line or clipboard.

import webbrowser, sys, 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) 

2.翻wall

3.复制: 870 Valencia St, San Francisco, CA 94110

4.运行脚本

5.结果如下

 

posted @ 2018-05-11 17:20  暮良文王  阅读(594)  评论(0编辑  收藏  举报