当前位置:网站首页>如何向 google colab 快速上传文件
如何向 google colab 快速上传文件
2022-07-24 17:53:00 【samll-guo】
分为如下几个步骤:
Step#1 连接到 google 云盘:
from google.colab import drive
drive.mount('/content/drive',force_remount = True)执行成功后,会显示: Mounted at /content/drive
Step#2 进入子目录 My Drive:
import os
root_dir = "/content/drive/My Drive/"
os.chdir(root_dir)确认:
显示: /content/drive/MyDrive
Step#3 建立子目录 "Colab_Notebooks" :
!mkdir "Colab_Notebooks"
Step#4 进入子目录:
import os
os.chdir("Colab_Notebooks")Step#5 再建立下一级及目录 "Project_folder":
!mkdir "Project_folder"
Step#6 进入刚建好的下一级子目录:
import os
root_dir = "/content/drive/My Drive/"
project_folder = "Colab_Notebooks/Project_folder/"
os.chdir(root_dir + project_folder)Step#7 查看现在所在的目录:
!pwd显示结果:/content/drive/My Drive/Colab_Notebooks/Project_folder
Step#8 现在,开始上传文件:
from google.colab import files
files.upload()
执行这一段代码后,会显示一个选择文件的对话窗口。
我可以上传我的文件: myfunctions.py
此文件我已经在我的本地C盘准备好了。选择这个文件后,就会自动上传。
在我的 myfunctions.py ,中有如下内容:
def sum_two(num_1, num_2):
result = num_1 + num_2
return resultStep#9 现在,我可以进行跨文件的函数调用:
import myfunctions
result = myfunctions.sum_two(100,200)
print (result)显示结果: 300
边栏推荐
- Link editing tips of solo blog posts illegal links
- C language custom types - Enumeration
- C language custom type explanation - Consortium
- The use and Simulation of character and string library functions in C language
- 仅需一个依赖给Swagger换上新皮肤,既简单又炫酷!
- Use prometheus+grafana to monitor MySQL performance indicators
- 0616项目二结束~~总总结
- Pay close attention! List of the latest agenda of 2022 open atom open source Summit
- Preliminary understanding of redis
- 生信常用分析图形绘制02 -- 解锁火山图真谛!
猜你喜欢

After separation, the impression notes are still difficult to live, but there are many coquettish operations

C # print reports using fastreport.net

C language programming training topics: K characters in left-handed string, little Lele and Euclidean, printing arrow pattern, civil servant interview, poplar matrix

Common questions of testers during interview

生信常用分析图形绘制02 -- 解锁火山图真谛!

Shardingsphere database read / write separation

What are the pitfalls from single architecture to distributed architecture?

OpenCV 图片旋转
![[leetcode] 30. Concatenate substrings of all words](/img/21/3965532a31553cfe6edf64ca5de3f4.png)
[leetcode] 30. Concatenate substrings of all words

分家后印象笔记过日子依然不好过,骚操作却不少
随机推荐
Goodbye Navicat! This open source database management tool has a cooler interface!
Get the data of Tongcheng (elong) Hotel
0621~ES&Lucene
[leetcode] 30. Concatenate substrings of all words
wallys/IPQ8074A 4x4 2.4G 8x8 5G 802.11ax
Interview assault 66: what is the difference between request forwarding and request redirection?
Trends of semiconductor industry
High performance complexity analysis of wechat circle of friends
二维卷积——torch.nn.conv2d的使用
SV casts and constants
The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced
Tensorflow introductory tutorial (38) -- V2 net
213. 打家劫舍 II-动态规划
0616 end of Project II ~ ~ general summary
C language custom types - Enumeration
运维小白成长记——架构第8周
Pay close attention! List of the latest agenda of 2022 open atom open source Summit
The solution of single chip microcomputer not supporting printf floating point type
Can CSC open an account for domestic futures? Is it safe?
0627~放假知识总结