【好用】透视体搜索浏览器(厉害!)
引言:
我相信大家在网上搜索资料时,一定会感到一个百度不够用,切换到别的搜索网站又太麻烦了,今天,我给大家带来一个很好的Python程序:透视体搜索浏览器
代码:
from webbrowser import*
while True:
a = input("1.搜索:2.退出")
if a == "1":
c= input("1.维基;2.bing;3.百度;4.360;5.B站")
b = input("请输入:")
if "1" in c:
#*
open("http://zh.m.wiki.sxisa.org/wiki/"+b)
if "2" in c:
#bing
open("https://cn.bing.com/search?q="+b+"&form=CHRDEF&sp=-1&pq=%E6%88%91&sc=8-1&qs=n&sk=&cvid=0E66E88FDBCA4485B1F4649966BC6CB8")
if "3" in c:
#baidu
open("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd="+b+"&fenlei=256&rsv_pq=de34903400083477&rsv_t=b4d5XteuAhcjh0%2FBpQ9QXdmyv1nYpD1DIe1eh2rdycdtB7Yo7MzO6ZHLCfw&rqlang=cn&rsv_enter=1&rsv_dl=tb&rsv_sug3=18&rsv_sug1=15&rsv_sug7=101&rsv_sug2=0&rsv_btype=i&prefixsug=%25E7%25BD%2591%25E6%2598%2593%25E5%2585%25AC%25E5%25BC%2580%25E8%25AF%25BE&rsp=5&inputT=3120&rsv_sug4=5028"+b)
if "4" in c:
#360
open("https://www.so.com/s?ie=utf-8&src=hao_360so_a1004_b_cube&shb=1&hsid=5400f217866c71a4&q="+b)
if "5" in c:
#哔哩哔哩
open("https://search.bilibili.com/all?keyword="+b+"&spm_id_from=333.1007")
else:
break
讲解
第一步
from webbrowser import*
webbrowser是一个非常好用的库
第二步
while True:
a = input("1.搜索:2.退出")
if a == "1":
c= input("1.维基;2.bing;3.百度;4.360;5.B站")
b = input("请输入:")
else:
break
a 是询问要不要继续搜索,如果a = 2,就退出程序
c是要搜索的网站,输入不同的数字就能在不同的网站进行搜索
b是搜索的内容
第三步:
if "1" in c:
#*
open("http://zh.m.wiki.sxisa.org/wiki/"+b)
if "2" in c:
#bing
open("https://cn.bing.com/search?q="+b+"&form=CHRDEF&sp=-1&pq=%E6%88%91&sc=8-1&qs=n&sk=&cvid=0E66E88FDBCA4485B1F4649966BC6CB8")
if "3" in c:
#baidu
open("https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd="+b+"&fenlei=256&rsv_pq=de34903400083477&rsv_t=b4d5XteuAhcjh0%2FBpQ9QXdmyv1nYpD1DIe1eh2rdycdtB7Yo7MzO6ZHLCfw&rqlang=cn&rsv_enter=1&rsv_dl=tb&rsv_sug3=18&rsv_sug1=15&rsv_sug7=101&rsv_sug2=0&rsv_btype=i&prefixsug=%25E7%25BD%2591%25E6%2598%2593%25E5%2585%25AC%25E5%25BC%2580%25E8%25AF%25BE&rsp=5&inputT=3120&rsv_sug4=5028"+b)
if "4" in c:
#360
open("https://www.so.com/s?ie=utf-8&src=hao_360so_a1004_b_cube&shb=1&hsid=5400f217866c71a4&q="+b)
if "5" in c:
#哔哩哔哩
open("https://search.bilibili.com/all?keyword="+b+"&spm_id_from=333.1007")
这是进行搜索的内容