使用Jupyter notebooks上传文件夹或大量数据到服务器
作者:kkkdropout 时间:2023-02-26 11:49:16
我们都知道如何上传单个文件,但如果有大量文件或大量数据,这就扎心了,可能会变得单调。因此目前想到一种办法,将文件压缩成zip包,然后再解压到工作目录
解压缩文件
import zipfile
import os
files = zipfile.ZipFile('homework.zip', 'r')
files.extractall(os.getcwd())
files.close()
打包成zip
但是,有时可能还需要从笔记本中下载多个文件。有几种方法可以做到这一点,但最简单的方法是压缩目录并下载zip文件:
import shutil
shutil.make_archive(output_filename_dont_add_.zip, 'zip', directory_to_download)
拓展:如果通过上面那种解压方式,文件中有中文名字的话会出现乱码,由于暂时没有这种需求,所以就不贴了
补充知识:jupyter notebook 上传文件夹问题
jupyter notebook本地直接解压缩后,只能上传单个或多个文件,多个文件夹无法上传。
直接在本地的文件夹下:C:\Users\Administrator(自己的电脑路径),直接拷贝文件夹即可。
来源:https://blog.csdn.net/weixin_40957741/article/details/91126638
标签:Jupyter,notebooks,文件夹,数据,服务器
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python通过文本和图片生成词云图
2023-08-03 09:39:35
![](https://img.aspxhome.com/file/2023/3/82963_0s.jpg)
js表单验证控制代码大全
2010-03-07 14:25:00
VB应用程序访问SQL Server的常用方法
2009-01-21 14:28:00
Python中用max()方法求最大值的介绍
2021-12-08 09:33:06
python集合的新增元素方法整理
2022-10-13 02:45:28
MySQL中出现乱码问题的终极解决宝典
2024-01-27 15:03:30
![](https://img.aspxhome.com/file/2023/4/100344_0s.png)
Go结合Gin导出Mysql数据到Excel表格
2024-01-21 05:43:50
![](https://img.aspxhome.com/file/2023/3/134013_0s.png)
vue日历/日程提醒/html5本地缓存功能
2024-04-28 09:30:15
![](https://img.aspxhome.com/file/2023/6/132946_0s.png)
eslint常见的一些报错及解决方法
2024-05-11 09:09:32
![](https://img.aspxhome.com/file/2023/0/126580_0s.png)
python如何编写类似nmap的扫描工具
2022-05-09 15:19:44
Python之 requests的使用(一)
2023-01-06 16:02:09
python利用beautifulSoup实现爬虫
2022-05-17 21:10:34
如何创建并使用一个断开连接的记录集的数据访问页?
2009-11-14 20:50:00
Python3标准库总结
2022-10-22 13:36:47
利用Python/R语言分别解决金字塔数求和问题
2021-09-06 06:29:14
![](https://img.aspxhome.com/file/2023/0/79500_0s.png)
实现PHP多线程异步请求的3种方法
2024-05-03 15:49:31
javascript基础之indexOf函数
2008-06-25 13:28:00
Python中使用json.load()和json.loads()加载json数据的方法实例
2021-12-15 20:12:31
教你解决往mysql数据库中存入汉字报错的方法
2024-01-15 02:32:06
![](https://img.aspxhome.com/file/2023/7/106587_0s.png)
pycharm使用anaconda全过程
2023-07-19 04:57:12
![](https://img.aspxhome.com/file/2023/3/63873_0s.jpg)