我希望能够使用以下程序将硬盘中的文件上传到Google云端硬盘:
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
drive = GoogleDrive(gauth)
this_file = 'apple.txt'
this_file.Upload()
但是,出现以下错误:
AttributeError: 'str' object has no attribute 'Upload'
如何上传?
最佳答案
示例here表示要执行以下操作:
this_file = drive.CreateFile()
this_file.SetContentFile('apple.txt') # Read file and set it as a content of this instance.
this_file.Upload() # Upload it
关于python - 无法将文件上传到Google云端硬盘,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25559486/