python3问题-python 此应用无法在你的电脑上运行,拒绝访问 使用安装包,remove,再安装

python 此应用无法在你的电脑上运行,拒绝访问

双击安装包,remove,再安装

最近写python遇到的一些问题,望给大家一点帮助。我是小王,CSDN博客:https://blog.csdn.net/cmqwan

-*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import requests as req import pandas as pd import matplotlib.pyplot as plt import time import re url=&#39;http://wenshu.court.gov.cn/List/ListContent&#39; Index=1 SleepNum= 3 dates=[] titles=[] nums=[] while (Index < 123): my_headers={&#39;User-Agent&#39;:&#39;User-Agent:Mozilla/5.0(Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.95Safari/537.36 Core/1.50.1280.400&#39;,} data={&#39;Param&#39;:&#39;全文检索:执行&#39;, &#39;Index&#39;: Index,&#39;Page&#39;:&#39;20&#39;,&#39;Order&#39;:&#39;裁判日期&#39;, &#39;Direction&#39;:&#39;asc&#39;} r=req.post(url,headers=my_headers, data = data) raw=r.json() pattern1= re.compile(&#39;"裁判日期":"(.*?)"&#39;,re.S) date= re.findall(pattern1,raw) pattern2= re.compile(&#39;"案号":"(.*?)"&#39;,re.S) num= re.findall(pattern2,raw) pattern3= re.compile(&#39;"案件名称":"(.*?)"&#39;,re.S) title= re.findall(pattern3,raw) dates+=date titles+=title nums+=num time.sleep(SleepNum) Index+= 1 df=pd.DataFrame({&#39;时间&#39;:dates,&#39;案号&#39;:nums, &#39;案件名称&#39;:titles}) df.to_excel(&#39;E:\result.xlsx&#39;)  console内容: Python 2.7.11 |Anaconda 4.1.0 (64-bit)| (default, Jun 15 2016, 15:21:11) [MSC v.1500 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 4.2.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython&#39;s features. %quickref -> Quick reference. help -> Python&#39;s own help system. object? -> Details about &#39;object&#39;, use &#39;object??&#39; for extra details. %guiref -> A brief reference about the graphical user interface. runfile(&#39;C:/Users/xx/.spyder2/temp.py&#39;, wdir=&#39;C:/Users/xx/.spyder2&#39;) Traceback (most recent call last): File "", line 1, in runfile(&#39;C:/Users/xx/.spyder2/temp.py&#39;, wdir=&#39;C:/Users/xx/.spyder2&#39;) File "D:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "D:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, &#39;exec&#39;), glob, loc) File "C:/Users/xx/.spyder2/temp.py", line 50, in df.to_excel(&#39;E:\result.xlsx&#39;) File "D:\Anaconda2\lib\site-packages\pandas\core\frame.py", line 1427, in to_excel excel_writer.save() File "D:\Anaconda2\lib\site-packages\pandas\io\excel.py", line 1444, in save return self.book.close() File "D:\Anaconda2\lib\site-packages\xlsxwriter\workbook.py", line 297, in close self._store_workbook() File "D:\Anaconda2\lib\site-packages\xlsxwriter\workbook.py", line 605, in _store_workbook xml_files = packager._create_package() File "D:\Anaconda2\lib\site-packages\xlsxwriter\packager.py", line 139, in _create_package self._write_shared_strings_file() File "D:\Anaconda2\lib\site-packages\xlsxwriter\packager.py", line 286, in _write_shared_strings_file sst._assemble_xml_file() File "D:\Anaconda2\lib\site-packages\xlsxwriter\sharedstrings.py", line 53, in _assemble_xml_file self._write_sst_strings() File "D:\Anaconda2\lib\site-packages\xlsxwriter\sharedstrings.py", line 83, in _write_sst_strings self._write_si(string) File "D:\Anaconda2\lib\site-packages\xlsxwriter\sharedstrings.py", line 110, in _write_si self._xml_si_element(string, attributes) File "D:\Anaconda2\lib\site-packages\xlsxwriter\xmlwriter.py", line 122, in _xml_si_element self.fh.write("""%s""" % (attr, string)) File "D:\Anaconda2\lib\codecs.py", line 706, in write return self.writer.write(data) File "D:\Anaconda2\lib\codecs.py", line 369, in write data, consumed = self.encode(object, self.errors) UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0xe6 in position 7: ordinal not in range(128) runfile(&#39;C:/Users/xx/.spyder2/temp.py&#39;, wdir=&#39;C:/Users/xx/.spyder2&#39;)ERROR: execution aborted
©️2020 CSDN 皮肤主题: 像素格子 设计师:CSDN官方博客 返回首页