《编程快速上手》--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.结果如下

猜你喜欢

转载自www.cnblogs.com/liangmingshen/p/9025730.html