企业网站首页设计评价/百度竞价托管靠谱吗
Google colab中调用自定义模块
- 从本地将包括自定义模块的.py文件上传到google drive文件夹下,如我这里使用的是hello.py中的hello()模块。我将hello.py文件放到了"/content/drive/My Drive/Colab Notebooks/demo"文件目录下;
def hello():print('hello!')
- 新建一个google colab文件,我这里命名为“test”;
分别输入一下代码:
import os
from google.colab import drive
drive.mount('/content/drive')
path = "/content/drive/My Drive/Colab Notebooks/demo"
os.chdir(path)
os.listdir(path)
from hello import hello
hello()
最后成功打印:
hello!