我得到這個值誤差值錯誤,要求超過2個值
ValueError: need more than 2 values to unpack)
,我不知道這意味着什麼。
這裏是我的代碼:
調用dict.items()
鍵和值時
contact_map = {'Dennis Jones': ('989-123-4567', '[email protected]'), 'Susan': ('517-345-1234', '[email protected]'), 'Miller, Matthew': ('616-765-4321', '[email protected]')}
FORM = "{:<s};{:<d};{:<s}"
out_file = input("Enter a name for the output file: ")
output_file= open(out_file, "w")
for name, phone, email in contact_map.items():
output_file.write(FORM.format(name, phone, email))
output_file.close()