I cloned a github repo using !git clone https://github.com/llSourcell/Pokemon_GAN.git
. I wanted to modify a .py file inside Colab. So i used %load fil
Solution:
p = """
Yadda yadda
whatever you want just don't use triple quotes.
"""
c = """text_file = open("text.text", "w+");text_file.write(p);text_file.close()"""
exec(c)
I found it easier to edit the file locally.
mv
to move the file to the right location.Not a perfect solution but can be useful for someone.
You can use
!cat file_name.py
to access file_name.py
contents, copy the contents in the next cell and now you can run it or edit it.
There is an app called Python Compiler Editor that you can connect to your Google Drive account, edit files and save them back.
While I don't have a way of editing in the notebook, I will share my pipeline. Quite obvious really:
Hope that helps.