how to import custom libraries in colab

Solutions on MaxInterview for how to import custom libraries in colab by the best coders in the world

showing results for - "how to import custom libraries in colab"
Lorenzo
07 Jan 2019
1#NOTE:- FILE NAMES ARE ALWAYS CASE SENSITIVE
2##In colab cell,insert the following code..
3
4from google.colab import files
5uploaded = files.upload()
6for file in uploaded:
7  print("file name : {} , length: {}".format(file,len(file)))
8  
9##after you run the cell simply select the file you want to upload
10#after you have selected the correct file you will see the following:
11'''
12chosen_file_name.py(text/x-python) - 1842 bytes, last modified: 09/06/2020 - 100% done
13Saving chosen_file_name.py to chosen_file_name.py
14file name : chosen_file_name.py , length:(the length of file)
15'''
16#Now simply write in the cell 
17import chosen_file_name
18#You are now done :)