Issue
I have a file on Google Collab x.ipynb
and I would like to open it. Simple
%run x.ipynb
would run it but inside a single cell.
Instead, I would like to have the same effect as I uploaded that file:
Which opens a new colab notebook for me. I searched Code snippets "open" but haven't found what I need.
Solution
First, connect to your Google Drive files --
from google.colab import drive
drive.mount('/content/drive')
Then, copy the notebook into Drive --
cp x.ipynb /content/drive/My\ Drive/
Then, use xattr
to obtain the file identifier --
!xattr -p 'user.drive.id' /content/drive/My\ Drive/x.ipynb
Then, you can open that notebook like so:
https://colab.research.google.com/drive/...drive file ID goes here...
Answered By - Bob Smith
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.