def print_objects(object_list):
'''Print name, size, and creation date of objects in list.
Parameters
----------
object_list : list (of boto3 objects)
'''
object_names = objects2names(object_list)
if len(object_names):
maxlen = max(map(len, object_names))
dates = [t.last_modified.astimezone(tzlocal()).strftime('%Y/%m/%d (%H:%M:%S)')\
for t in object_list]
padding = '{0: <%i} {1} {2}M'%(min(maxlen+3, 70))
sizes = [round(t.meta.data['Size']/2.**20,1) for t in object_list]
info = [padding.format(name[-100:],date,size) for name,date,size in zip(object_names, dates, sizes)]
print('\n'.join(info))
# object naming convention
##############################
评论列表
文章目录