You can check this alternative which uses filter
:
import boto3
s3r = boto3.resource('s3')
all_files = list(s3r.Bucket('bucket').objects.filter(Prefix='folder/').all())
print(all_files[-1])
It does not do semantic check based on the dates in your files to find the last one. But the example could be extended to do it as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…