# 做个简单代理搜索
from urllib import request,parse
def search(wd):
base_url = 'http://www.baidu.com/s?'
qs = {
'wd' : wd
}
qs = parse.urlencode(qs)
base_url = base_url + qs
response = request.urlopen(base_url)
print(response.read().decode('utf-8'))
def main():
while True:
wd = input('请输入要查找的内容 :')
if wd == 'q':
break
search(wd)
if __name__ == '__main__':
main()
兄弟连学python
Python学习交流、资源共享群:563626388 QQ