Created
July 20, 2019 19:25
-
-
Save haruiz/c39398093b3009a51b1b5e209958461d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.colab import drive | |
import os | |
def create_folder_gdrive(folder: str): | |
drive2mount = "/gdrive" | |
drive.mount(drive2mount, force_remount=True) | |
root_folder = os.path.join(drive2mount,"My Drive", folder) | |
os.makedirs(root_folder,exist_ok=True) | |
return root_folder | |
root_folder = create_folder_gdrive("myfolder") | |
test_file =os.path.join(root_folder, 'foo.txt') | |
with open(test_file, 'w') as f: | |
f.write('Hello Google Drive!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment