ami*_*o21 -3 python
假设我有一个元素列表
tagsList = ['dun', 'dai', 'che']
如何将以上内容转换为以下内容?
tagsDictionaries = [ { 'name': 'dun' }, { 'name': 'dai' }, { 'name': 'che' } ]
我想用for循环来做这个
for
Bre*_*arn 5
tagsDictionaries = [{'name': item} for item in tagsList]
归档时间:
7 年,8 月 前
查看次数:
50 次
最近记录: