新澳门萄京娱乐场eclipse配置pydev解释器

新澳门萄京娱乐场 5

1、eclipse->windows->preferences

Python3,代码如下:1#py006.py3.py23importurllib.request4importurllib.parse5importre6frombs4importBeautifulSoup789defmain():10keyword=input(“请输入词条关键字:”)11keyword=urllib.parse.urlencode({“word”:keyword})12#response=urllib.request.urlopen(“%s”%keyword)13response=urllib.request.urlopen(“%s”%keyword)14html=response.read().decode(“utf-8″)15soup=BeautifulSoup(html,”html.parser”)161718foreachinsoup.find_all(href=re.compile(“view”)):19content=”.join([each.text])20url2=”.join([“”,each[“href”]])21response2=urllib.request.urlopen(url2)22html2=response2.read()23soup2=BeautifulSoup(html2,”html.parser”)24ifsoup2.h2:25content=”.join([content,soup2.h2.text])26content=”.join([content,”-“,url2])27print(each)28print(content)29303132if__name__==”__main__”:33main()================分割线===========================报错如下:[root@BLUBN-ALY-02py_WestPoint3]#pypy007.190830py3.py请输入词条关键字:中国Traceback(mostrecentcalllast):File”py007.190830py3_MyFirstPanChong_V0.11.py”,line33,inmodulemain()File”py007.190830py3_MyFirstPanChong_V0.11.py”,line21,inmainresponse2=urllib.request.urlopen(url2)File”/home/python/python3/lib/python3.6/urllib/request.py”,line223,inurlopenreturnopener.open(url,data,timeout)File”/home/python/python3/lib/python3.6/urllib/request.py”,line526,inopenresponse=self._open(req,data)File”/home/python/python3/lib/python3.6/urllib/request.py”,line544,in_open’_open’,req)File”/home/python/python3/lib/python3.6/urllib/request.py”,line504,in_call_chainresult=func(*args)File”/home/python/python3/lib/python3.6/urllib/request.py”,line1346,inhttp_openreturnself.do_open(,req)File”/home/python/python3/lib/python3.6/urllib/request.py”,line1318,indo_openencode_chunked=req.has_header(‘Transfer-encoding’))File”/home/python/python3/lib/python3.6/”,line1239,inrequestself._send_request(method,url,body,headers,encode_chunked)File”/home/python/python3/lib/python3.6/”,line1250,in_send_requestself.putrequest(method,url,**skips)File”/home/python/python3/lib/python3.6/”,line1117,inputrequestself._output(request.encode(‘ascii’))UnicodeEncodeError:’ascii’codeccan’tencodecharactersinposition36-39:ordinalnotinrange(128)[root@BLUBN-ALY-02py_WestPoint3]#whichpyaliaspy=’python3’/home/python/python3/bin/python3

新澳门萄京娱乐场 1

2、在python目录中选择python.exe

新澳门萄京娱乐场 2

3、出现下图,全选ok即可

新澳门萄京娱乐场 3

4、搞定,可以开始写代码了,新建一个python工程

新澳门萄京娱乐场 4

 新澳门萄京娱乐场 5

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注