我想創建詞典鍵和值 但我得到的語法錯誤:通過提供密鑰和變量的值,創建自變量給出語法錯誤
disk_to_dm_dict = {}
for line in dm_name:
match = re.search(lun_reg,line)
if match:
lun=match.group(6)
dm=match.group(8)
print lun
print dm
#Create Dictionary with key= LUN and Value=dm
disk_to_dm_dict['%s']%lun = dm
,但我得到的錯誤
File "read_lun.py", line 42
disk_to_dm_dict["%s"]%lun = dm
SyntaxError: can't assign to operator