Colab读写google drive文件
# 将谷歌drive挂载到当前的会话
from google.colab import drive
drive.mount('/content/gdrive')
# 读文件
# '/content/gdrive/My Drive/' 为谷歌云端硬盘的根目录
data = pd.read_csv('/content/gdrive/My Drive/data/digits/train.csv')
# 写文件
with open('/content/gdrive/My Drive/file.text', 'w') as f:
f.write('hello')
f.close()
安装python库
在colab下安装python库一般会用到下面的命令`
!pip install py-library
example: !pip install conf