How to import python files in google colaboratory?

后端 未结 4 1973
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 15:33

I am trying to run my program on Google Colab; where my code make use of .py files written seprately.

In normal system I have all files inside one folder and it wor

4条回答
  •  被撕碎了的回忆
    2021-01-02 16:16

    For example you have a module like this

    simple.py
    def helloworld():
       print("hello")
    

    Click arrow on left panel => Choose File tab => Upload simple.py In notebook code like this

    import simple
    simple.helloworld()
    => hello
    

提交回复
热议问题