给定一个到S3 bucket的路径,我需要在同一路径中找到另一个文件并处理它
对于那里的每个对象,我都有一个文件路径,在该路径中,我可以找到相应的客户文件,正如您在终端的这些打印中看到的:
In [7]: HouseList.objects.get(id=11508).file_path
Out[7]: u'85/1545927/omc_emea_hl_small.csv'
In [8]: CustomerFile.objects.get(id=5031).file_path
Out[8]: u'85/1545927/omc_emea_pos_small.csv'
有没有一种方法,在给定路径前缀的情况下,获取位于该路径的所有文件的列表
^{} 函数可以返回给定前缀的对象列表:
所以,你可以用这样的方法:
您可以使用Python中的s3boto模块列出具有给定前缀的文件:http://boto.cloudhackers.com/en/latest/ref/s3.html#boto.s3.bucket.Bucket.list
相关问题 更多 >
编程相关推荐