【发布时间】:2016-05-30 06:34:52
【问题描述】:
是否可以遍历 Amazon S3 存储桶中的文件/密钥,读取内容并使用 Python 计算行数?
例如:
1. My bucket: "my-bucket-name"
2. File/Key : "test.txt"
我需要遍历文件“test.txt”并计算原始文件中的行数。
示例代码:
for bucket in conn.get_all_buckets():
if bucket.name == "my-bucket-name":
for file in bucket.list():
#need to count the number lines in each file and print to a log.
【问题讨论】:
标签: python amazon-web-services amazon-s3 boto