I am using python 2.7.x, and Boto API 2.X to connect to AWS S3 bucket. I have list of files from S3 bucket and a corresponding timestamp in UTC format. I want to iterate through the this list and find out the max timestamp of the file and remove that key from the original list(from from the bucket). Can anyone please help to achieve this?
Here is my code.
for key_list in bucket_list: key = str(key_list.key) key1 = key_list.last_modified filename = str(key.split('/')[-1] +' '+ key_list.last_modified) print(filename)
Output:
1440169202312400000.7z 2015-09-02T21:51:52.000Z
1440169202312400001.7z 2015-09-02T21:51:52.000Z
1440176402308180001.7z 2015-09-02T21:51:57.000Z
1440183602306120000.7z 2015-09-02T21:51:57.000Z
1440183602306120001.7z 2015-09-02T21:51:59.000Z
1440190802314590000.7z 2015-09-02T21:51:59.000Z
1440190802314590001.7z 2015-09-02T21:52:01.000Z
1440198002317590000.7z 2015-09-02T21:52:02.000Z
1440198002317590001.7z 2015-09-02T21:52:02.000Z
So, my final output will be a list of keys without the "1440198002317590001.7z 2015-09-02T21:52:02.000Z " in it. Thank you in advance your hep is greatly appreciated!!
Aucun commentaire:
Enregistrer un commentaire