how to import python library in colab code example
Example 1: how to import custom libraries in colab
from google.colab import files
uploaded = files.upload()
for file in uploaded:
print("file name : {} , length: {}".format(file,len(file)))
'''
chosen_file_name.py(text/x-python) - 1842 bytes, last modified: 09/06/2020 - 100% done
Saving chosen_file_name.py to chosen_file_name.py
file name : chosen_file_name.py , length:(the length of file)
'''
import chosen_file_name
Example 2: colab import python file
from google.colab import drive
drive.mount('/content/gdrive/')
import sys
sys.path.append('/content/gdrive/mypythondirectory')