怎么利用Python将下面的名称变为dict,LPS_Tilt_X , LPS_Tilt_Y, LPS_Off_center_X , LPS_Off_center_Y , LPS_PV_100 , LPS_PV_99 , LPS_Astigmatism
时间: 2023-06-04 12:04:13 浏览: 115
可以使用下面的代码将这些名称变成一个包含键值对的字典:
```
names = ['LPS_Tilt_X', 'LPS_Tilt_Y', 'LPS_Off_center_X', 'LPS_Off_center_Y', 'LPS_PV_100', 'LPS_PV_99', 'LPS_Astigmatism']
d = {name:None for name in names}
print(d)
```
运行结果:
```
{'LPS_Tilt_X': None, 'LPS_Tilt_Y': None, 'LPS_Off_center_X': None, 'LPS_Off_center_Y': None, 'LPS_PV_100': None, 'LPS_PV_99': None, 'LPS_Astigmatism': None}
```
阅读全文