【发布时间】:2023-04-08 03:00:01
【问题描述】:
我正在尝试使用 Python 2.7 从列表中创建字典
这是我的清单:
x = ['+proj=geos',
'lon_0=86.5',
'h=35785993.3373',
'x_0=0',
'y_0=0',
'a=6378160',
'b=6356775',
'units=m',
'no_defs ']
在我列表中的每个元素中,都有我的键和我的值,它们用字符“=”分隔。 结果,我想要这个:
d = {"+proj": "geos", "lon_0": "86.5", "h": "35785993.3373", "x_0": "0", "y_0": "0", "a": "6378160", "b": "6356775", "units": "m"}
【问题讨论】:
标签: python python-2.7 list dictionary