我正在使用此代码将文件上传到代码实验室。
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
print('User uploaded file "{name}" with length {length} bytes'.format(
name=fn, length=len(uploaded[fn])))
但我需要将其保存到特定目录中,以便稍后使用sklearn.datasets.load_files加载它们。
train_data = load_files(train_dir,encoding='utf-8', decode_error='ignore', random_state=2018)
test_data = load_files(test_dir,encoding='utf-8', decode_error='ignore', random_state=2018)
感谢您提前帮助我