Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何替换Google Colab中的文件_Python_File_Google Colaboratory - Fatal编程技术网

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
后遇到的错误