尝试用google colab训练自己的神经网络(二)

这篇博客介绍了如何在Google Colab上挂载Google Drive并读取数据,包括txt和csv格式,以进行深度学习模型的训练。作者分享了一种便捷的数据处理方法。
摘要由CSDN通过智能技术生成

接下来我们要读取数据了,

首先挂载google drive:

# Install the PyDrive wrapper & import libraries.
# This only needs to be done once per notebook.
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

# Authenticate and create the PyDrive client.
# This only needs to be done once per notebook.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)

然后读取我们的内容,

txt格式:

    file = drive.CreateFile({'id': '你的文件id'}) 

    file.GetContentFile('你的文件名.txt',"text/plain")

csv格式:

    file = drive.CreateFile({'id': '你的文件id
  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值