I had a question regarding my code which downloads a file from S3 with the highest (most recent) timedated filename format:
YYYYMMDDHHMMSS.zip
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import sys
conn = S3Connection('____________________', '________________________________________')
bucket = conn.get_bucket('bucketname')
rs = bucket.list("FamilyPhotos")
for key in rs:
print key.name
keys = [(key,datetime.strptime(key.name,'%Y%m%d%H%M%S.zip')) for key in rs]
sorted(keys, key = lambda element : element[1])
latest = keys[0][1]
latest.get_contents_to_filename()
I havent done a lot of python before so I would really appreciate some feedback.