Python 如何替换Google Colab中的文件
这是我从谷歌硬盘下载和解压文件的代码Python 如何替换Google Colab中的文件,python,file,google-colaboratory,Python,File,Google Colaboratory,这是我从谷歌硬盘下载和解压文件的代码 fileId = drive.CreateFile({'id': '1tQq-ihnTbRj6GlObBrm17Ob6j1XHHJL2'}) print (fileId['title']) fileId.GetContentFile('tweets_research.zip') !unzip tweets_research.zip -d ./ 但是已经有一些文件了,我想替换它们。它给了我 这个选项 但不管我在键盘上按什么键,它都不工作。使用-o选项覆盖
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 ./
使用
-o
选项覆盖文件,例如
!unzip -o tweets_research.zip -d ./
您可以使用管道将您的选择作为输入回显到命令中 如果重命名:
!echo "r"| unzip tweets_research.zip -d ./
您可以使用管道将您的选择作为输入回显到命令中 如果重命名:
!echo "r"| unzip tweets_research.zip -d ./
注意:文件名不匹配:./
这是我在添加-o
后遇到的错误。注意:文件名不匹配:./
这是我在添加-o
后遇到的错误