【发布时间】:2012-02-02 01:56:52
【问题描述】:
我正在使用 blobstore 在 Python 版 Google App Engine 中上传和下载文件。我了解如何将对象逐行写入 blobstore,并且我了解如何发布和下载 blobstore 项目,但是如果我只有 blobstore 键,我如何逐行从 blobstore 中读取数据?
file_name = files.blobstore.create(mime_type='application/octet-stream')
with files.open(file_name, 'a') as f:
f.write("data")
files.finalize(file_name)
# Get the file's blob key
blob_key = files.blobstore.get_blob_key(file_name)
#starting with the blob_key, read from the blobstore line-by-line.
# ???
#with files.open() as f:
#foo = f.read()
【问题讨论】:
标签: google-app-engine blobstore