Read a file line by line from S3 using boto?

前端 未结 10 1042
刺人心
刺人心 2020-11-29 07:32

I have a csv file in S3 and I\'m trying to read the header line to get the size (these files are created by our users so they could be almost any size). Is there a way to do

10条回答
  •  感情败类
    2020-11-29 07:45

    You may find https://pypi.python.org/pypi/smart_open useful for your task.

    From documentation:

    for line in smart_open.smart_open('s3://mybucket/mykey.txt'):
        print line
    

提交回复
热议问题