小编Fat*_*ror的帖子

致命的 Python 错误:init_sys_streams:无法初始化 sys 标准流 AttributeError:模块 'io' 没有属性 'OpenWrapper'

直到昨天,Python 3 安装都运行良好。然后今天就发生了。键入 Python 时命令提示符 (Windows 10) 的输出:

Fatal Python error: init_sys_streams: can't initialize sys standard streams
AttributeError: module 'io' has no attribute 'OpenWrapper'

Current thread 0x00001204 (most recent call first):
Run Code Online (Sandbox Code Playgroud)

谷歌搜索并彻底搜索以前问题的答案似乎没有任何帮助。

以防万一,在此之前使用带有 VS 代码的 Python 3。

还尝试卸载当前的 Python(3.6.5) 并重新安装最新的 Python(3.7.0),但错误仍然存​​在。任何帮助,将不胜感激。

python python-3.x

7
推荐指数
1
解决办法
1万
查看次数

Python requests.get()返回破碎的源代码而不是预期的源代码?

在上面的维基百科页面上提出了请求.具体来说,我需要从https://en.wikipedia.org/wiki/2017%E2%80%9318_La_Liga#Results中删除"结果矩阵"

selectedSeasonPage = requests.get('https://en.wikipedia.org/wiki/2017–18_La_Liga', features='html5lib')
Run Code Online (Sandbox Code Playgroud)

pprint.pprint(selectedSeasonPage.text)和跳转到矩阵的源代码,可以看出它是不完整的.

requests.get()返回的HTML片段:

<table class="wikitable plainrowheaders" style="text-align:center;font-size:100%;">
.
.
<th scope="row" style="text-align:right;"><a href="/wiki/Deportivo_Alav%C3%A9s" title="Deportivo Alavés">Alavés</a></th>
<td style="font-weight: normal;background-color:transparent;">— </td>
<td style="white-space:nowrap;font-weight: normal;background-color:transparent;"></td>
<td style="white-space:nowrap;font-weight: normal;background-color:transparent;"></td>
<td style="white-space:nowrap;font-weight: normal;background-color:transparent;"></td>
<td style="white-space:nowrap;font-weight: normal;background-color:transparent;"></td>
<td style="white-space:nowrap;font-weight: normal;background-color:transparent;"></td>
<td style="white-space:nowrap;font-weight: normal;background-color:#BBF3FF;">2–1</td>
Run Code Online (Sandbox Code Playgroud)

request.get()返回的HTML通过浏览器查看,并且预期它不完整. 可以查看此图片以供参考.

来自view-source的片段和所需的输出.

<table class="wikitable plainrowheaders" style="text-align:center;font-size:100%;">
.
.
<a href="/wiki/Deportivo_Alav%C3%A9s" title="Deportivo Alavés">Alavés</a></th>
<td style="font-weight: normal;background-color:transparent;">&#8212;</td>
<td style="white-space:nowrap;font-weight: normal;background-color:#BBF3FF;">3–1</td>
<td style="white-space:nowrap;font-weight: normal;background-color:#FFBBBB;">0–1</td>
<td style="white-space:nowrap;font-weight: normal;background-color:#FFBBBB;">0–2</td>
<td style="white-space:nowrap;font-weight: normal;background-color:#BBF3FF;">2–1</td>
<td style="white-space:nowrap;font-weight: normal;background-color:#BBF3FF;">1–0</td>
<td style="white-space:nowrap;font-weight: normal;background-color:#FFBBBB;">1–2</td>
Run Code Online (Sandbox Code Playgroud)

发布样本HTML以供参考,因为无法发布整个输出.如果需要,可以发布更具体的部件. …

python python-3.x python-requests

5
推荐指数
1
解决办法
87
查看次数

标签 统计

python ×2

python-3.x ×2

python-requests ×1