create dict in python

bobargs = dict((f + '__contains', 'bob') for f in ('title', 'subtitle', 'text', 'byline'))

this will create a dict 'bobargs' which contain filed 'title', 'subtitle', 'text', 'byline', and all fields will be signed will 'bob'

原文地址:https://www.cnblogs.com/henyihanwobushi/p/2676392.html