这是一个语法错误。在 Python 中,'!' 是一个特殊字符,用于在 Jupyter Notebook 或 IPython Shell 中执行终端命令。然而,在标准的 Python 解释器中,'!' 是无效的。

如果你想下载文件,可以使用 Python 的内置模块 urllib.request 来实现。以下是一个示例代码:

import urllib.request

url = 'https://labfile.oss.aliyuncs.com/courses/2616/seaborn-data.zip'
filename = 'seaborn-data.zip'

urllib.request.urlretrieve(url, filename)

这将从给定的 URL 下载文件,并将其保存为名为 'seaborn-data.zip' 的本地文件。

Python 下载文件:解决 !wget 语法错误

原文地址: https://www.cveoy.top/t/topic/phM4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录