How to run a Python script in a '.py' file from a Google Colab notebook?

前端 未结 6 2174
星月不相逢
星月不相逢 2021-01-31 17:14
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
    return false;
}

%run rl_base.py

I run this giving error saying rl_bas

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 17:43

    ##  1. Check in which directory you are using the command
    !ls
    ##  2.Navigate to the directory where your python script(file.py) is located using the command
    %cd path/to/the/python/file
    ## 3.Run the python script by using the command
    !python file.py
    

提交回复
热议问题