简体   繁体   中英

How to replace files in Google Colab

This is my code to download and unzip files from google drive.

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

But there are already some files and I want to replace them. It is giving me this option.

在此处输入图片说明 But it doesn't matter whatever I press on my keyboard it's not working.

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

!unzip -o tweets_research.zip -d ./

You can echo your choice as input to your command by using a pipe.

in case of rename:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM