控制台输入参数实例

#! 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)

 

posted @ 2019-03-13 16:24  晨光曦微  阅读(341)  评论(0编辑  收藏  举报