Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一组对象,我想为每个对象添加一个时间戳:
t = time.utcnow() for x in objects: x['created_at'] = t
有没有办法做到这一点?
不完全漂亮(假设x是一本字典):
x
t = time.utcnow() map(lambda x: x.update({'created_at': t}), objects)