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'

posted on 2012-09-08 11:03  很遗憾我不是  阅读(352)  评论(0编辑  收藏  举报