How to edit and save text files (.py) in Google Colab?

后端 未结 11 1891
[愿得一人]
[愿得一人] 2020-12-24 01:16

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

11条回答
  •  孤独总比滥情好
    2020-12-24 01:56

    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)
    

提交回复
热议问题