import webbrowser
webbrowser.open('https://www.xidian.edu.cn/')
跳转西电首页
#! python3
import webbrowser, sys, pyperclip
if len(sys.argv) > 1:
mapAddress = ''.join(sys.argv[1:])
else:
mapAddress = pyperclip.paste()
webbrowser.open('http://map.baidu.com/?newmap=1&ie=utf-8&s=s%26wd%3D' + mapAddress)
sys.argv用法:https://www.jb51.net/article/143370.htm;.join()用法的:https://www.jb51.net/article/134000.htm
sys.argv是字符串的列表,所以将它传递给join()方法返回一个字符串。
剪贴板内容为 西安
import requests
res = requests.get('http://tech.firefox.sina.com/17/0820/10/6DKQALVRW5JHGE1I.html##0-tsina-1-13074-397232819ff9a47a7b7e80a40613cfe1')
res.raise_for_status()
file = open('1.txt', 'wb') # 以写二进制模式打开文件,目的是保存文本中的“Unicode编码”
for word in res.iter_content(100000): # <span class="fontstyle0"><span class="fontstyle0">iter_content()</span><span class="fontstyle1">方法在循环的每次迭代中返回一段</span><span class="fontstyle0"&g