Python 2.7 谷歌硬盘文件下载中重复的空行

Python 2.7 谷歌硬盘文件下载中重复的空行,python-2.7,google-drive-api,drive,Python 2.7,Google Drive Api,Drive,我用的是一个同事写的代码。它将Google Drive Google文档下载到文本文件中。但是,它会复制文件中的每个空行。我当然可以通过在下载的数据中消除成对的换行来解决这个问题,但我敢打赌,我们不正确地使用了apiclient,应该能够下载一个字符串或可以直接写入文件的字符串列表。代码如下: #get document id with open('.'.join((ifile, 'gdoc'))) as data_file: data = json.load(data_file

我用的是一个同事写的代码。它将Google Drive Google文档下载到文本文件中。但是,它会复制文件中的每个空行。我当然可以通过在下载的数据中消除成对的换行来解决这个问题,但我敢打赌,我们不正确地使用了apiclient,应该能够下载一个字符串或可以直接写入文件的字符串列表。代码如下:

#get document id
with open('.'.join((ifile, 'gdoc'))) as data_file:    
    data = json.load(data_file)
gdoc_id = data['doc_id']

#download file
file = service.files().get(fileId=gdoc_id).execute()
resp, content = service._http.request(file['exportLinks']['text/plain'])
content = content[3:]
if resp.status == 200:
    local_fd = open('.'.join((ifile, ext)), "w")
    local_fd.write(content)
    local_fd.close()
    print('File saved')
我在谷歌硬盘文档中找不到答案

我想知道这是否与在HTTP see中使用CRLF作为行尾标记有关,我知道它已经被替换了。
谢谢

我直接使用导出链接获得了相同的结果事件。我可以很好地处理其他格式,只处理txt文件,它会显示重复的空行。请在此处提交错误报告,以便我们可以通知您进度:@EricKoleda我在此处提交了一份报告,在code.google.com中已经在此处提交了报告:您可以自己提交另一份报告。