Learn Before
Concept
Local file system
Uploading files from local system
from google.colab import files uploaded = files.upload() for fn in uploaded.keys(): print('User uploaded file "{name}" with length {length} bytes'.format( name=fn, length=len(uploaded[fn])))
files.upload() returns a dictionary of the files that were uploaded. Upon running this code snippet, the user can select a file to upload.
Downloading files from local system
from google.colab import files with open('example.txt', 'w') as f: f.write('some content') files.download('example.txt')
files.download() will invoke a browser download of the file to the local computer.
0
1
Updated 2021-05-30
Tags
Python Programming Language
Data Science