gpt4 book ai didi

python-3.x - 如何显示隐藏文件colab

转载 作者:行者123 更新时间:2023-12-05 04:49:10 24 4
gpt4 key购买 nike

我在 python3 上使用 colab 如何查看或显示隐藏文件

here

像这张图片一样,我看不到隐藏文件(.files)

最佳答案

与此同时,一个笨拙的解决方法是使用 !cp 将文件复制到您的 google 驱动器存储(如果您有),进行更改并将它们复制回来。示例:

from google.colab import drive
drive.mount("/content/gdrive")
%cd /root
%ls -a
> .cache/ .gsutil/ .local/ .tmux.conf* ... .bashrc* ...
!cp /root/.bashrc* /content/gdrive/folder
#make changes on bashrc and copy back
!cp /content/gdrive/folder/.bashrc /root/.bashrc

因为我使用的是 colab-ssh + github + vscode,所以我可以浏览 vscode 中的所有文件夹和文件并在那里进行更改。但此设置需要一些准备工作。
更快的方法是注册一个免费的 ngrok 帐户,复制 authtoken 并运行以下命令:

!pip install colabcode
from colabcode import ColabCode
ColabCode(password="anything", authtoken="your token")
.
.
.
Code Server can be accessed on: NgrokTunnel: "https://8348-34-125-56-97.ngrok.io" -> "http://localhost:10000"
[2022-03-31T08:01:58.749Z] info code-server 3.10.2 387b12ef4ca404ffd39d84834e1f0776e9e3c005
[2022-03-31T08:01:58.751Z] info Using user-data-dir ~/.local/share/code-server
..
..

单击 ngrok.io 链接后,您必须输入密码。编辑器打开后,您可以单击“打开文件夹”,选择基础“/”文件夹。您可以在那里浏览所有文件并直接在编辑器界面中进行更改: enter image description here

关于python-3.x - 如何显示隐藏文件colab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67698933/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com