如何替换 Google Colab 中的文件

How to replace files in Google Colab

这是我从 google 驱动器下载和解压缩文件的代码。

fileId = drive.CreateFile({'id': '1tQq-ihnTbRj6GlObBrm17Ob6j1XHHJL2'}) 
print (fileId['title'])
fileId.GetContentFile('tweets_research.zip')
!unzip tweets_research.zip -d ./

但是已经有一些文件,我想替换它们。它给我 这个选项。

但是不管我在键盘上按什么都不起作用。

使用-o选项覆盖文件,例如

!unzip -o tweets_research.zip -d ./

您可以使用管道将您的选择回显为命令的输入。

如果重命名:

!echo "r"| unzip tweets_research.zip -d ./