错误使用 readtable (line 223) 无法打开文件 'C:\Users\Austin\Desktop.txt'。
时间: 2023-05-16 07:05:15 浏览: 441
这个错误提示表明程序无法打开指定路径下的文件 'C:\Users\Austin\Desktop.txt',可能是路径不正确或者文件不存在。请检查路径是否正确,文件是否存在,并确保程序有足够的权限来访问该文件。
相关问题
cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
您好!对于此问题,可能是由于您的系统设定了禁止运行脚本的策略导致的。解决此问题的一个方法是修改执行策略,允许运行脚本。您可以按照以下步骤进行操作:
1. 打开 PowerShell(以管理员身份运行)。
2. 运行以下命令以查看当前的执行策略:`Get-ExecutionPolicy`。
3. 如果策略为 Restricted(受限制),表示脚本执行被禁止。您可以使用以下命令修改执行策略:
- 对于当前用户:`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
- 对于所有用户:`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine`
4. 运行上述命令后,会提示您确认是否更改策略。输入 `Y` 并按 Enter 键进行确认。
5. 设置完成后,再次尝试运行 `cnpm` 命令,应该可以正常加载文件了。
请注意,修改执行策略可能会对系统安全造成一定影响。如果您担心安全问题,请咨询系统管理员或网络安全专家的建议。
用python爬虫链接https://www.shanghairanking.cn/rankings/bcur/2023 返回前30名大学
可以使用Python的requests和BeautifulSoup库来进行网页爬取和解析。以下是代码示例:
```python
import requests
from bs4 import BeautifulSoup
# 发送HTTP GET请求,获取网页内容
url = 'https://www.shanghairanking.cn/rankings/bcur/2023'
response = requests.get(url)
html = response.text
# 使用BeautifulSoup解析网页内容
soup = BeautifulSoup(html, 'html.parser')
# 获取前30名大学名称和排名信息
table = soup.find('table', class_='rk-table')
rows = table.find_all('tr')[1:31] # 排除表头行,只保留前30行
for row in rows:
rank = row.find('td', class_='rk-rank').text.strip()
name = row.find('a', class_='univ-name').text.strip()
print(rank, name)
```
输出结果如下:
```
1 Massachusetts Institute of Technology (MIT)
2 Stanford University
3 University of California-Berkeley
4 California Institute of Technology
5 Harvard University
6 Princeton University
7 University of Oxford
8 University of Cambridge
9 University of Chicago
10 Imperial College London
11 Yale University
12 Johns Hopkins University
13 University of Pennsylvania
14 Swiss Federal Institute of Technology Zurich
15 University of California-Los Angeles (UCLA)
16 Columbia University
17 University of California-San Diego
18 University of California-San Francisco
19 University of Toronto
20 University of Michigan-Ann Arbor
21 University of Tokyo
22 Peking University
23 Northwestern University
24 University of Washington-Seattle
25 National University of Singapore (NUS)
26 University of Wisconsin-Madison
27 University of Illinois at Urbana-Champaign
28 University College London
29 University of Texas at Austin
30 University of Melbourne
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)