正在 Python 下载 Kaggle 文件

Downloading Kaggle files in Python

我的问题是以下问题的延续:documentation for Kaggle API *within* python?

所以,我用 Kaggle 下载了一个数据集 API:

api.dataset_download_files('berkeleyearth/climate-change-earth-surface-temperature-data',
                           path='datasets/kaggle', unzip=True)

有没有办法获取下载的 csv 文件的名称?或者我是否必须确保将文件下载(并解压缩)到我应该浏览的专用文件夹中?

在此处查看文档:https://technowhisp.com/kaggle-api-python-documentation/

5.2 Listing dataset files

api.dataset_list_files('avenn98/world-of-warcraft-demographics').files

pip install kaggle 

然后验证

Authenticating With API Server

 from kaggle.api.kaggle_api_extended import KaggleApi
 api = KaggleApi()
 api.authenticate()
Downloading Datasets

并下载

# Download all files of a dataset
# Signature: dataset_download_files(dataset, path=None, force=False, quiet=True, unzip=False)
api.dataset_download_files('avenn98/world-of-warcraft-demographics')

# downoad single file
#Signature: dataset_download_file(dataset, file_name, path=None, force=False, quiet=True)
api.dataset_download_file('avenn98/world-of-warcraft-demographics','WoW Demographics.csv')