我正在使用 google colab python 3,我想使用它在 jupyter notebook 中运行但不在 google colab 中运行的代码
我试过 !mkdir 但我还是不能加入他们
# Create a new directory
base_dir = 'base_dir'
os.mkdir(base_dir)
# create a path to 'base_dir' to which we will join the names of the new folder
# train_dir
train_dir = os.path.join(base_dir, 'train_dir')
os.mkdir(train_dir)
我想加入 base_dir 和 train_dir
最佳答案
也许这行得通:
import tensorflow as tf
#Create a new directory (a folder) in your Drive
tf.gfile.MkDir(base_dir)
#Combine the 2 strings
string = ('base_dir', 'train_dir')
s = ''
train_dir = s.join(string)
#Create the second directory
tf.gfile.MkDir(train_dir)
关于python-3.x - 在 google colab 中创建两个新目录并加入它们,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54172874/