是否可以在Amazon S3存储桶中循环访问文件/密钥,使用Python读取内容并计算行数?
例如:
1. My bucket: "my-bucket-name"
2. File/Key : "test.txt"
Run Code Online (Sandbox Code Playgroud)
我需要遍历文件“ 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.
Run Code Online (Sandbox Code Playgroud)