Google Colab运行py文件
- 进入自定义文件夹
import os
path="/content/drive/My Drive/Project"
os.chdir(path)
os.listdir(path)
- 运行目录下的.py文件(执行系统命令,需要在命令前加感叹号)
!python run.py
import os
path="/content/drive/My Drive/Project"
os.chdir(path)
os.listdir(path)
!python run.py