I am trying to create a dictionary from a txt file "PortList.txt" with information in similar format to below, but keep getting the error "TypeError: unhashable type: 'list'"
TCP 0 Reserved
TCP 1 Port Service Multiplexer
TCP 2 Management Utility
The Key will be the "TCP" and "0" while the value is "Reserved"
My opening code is:
portDictionary = {}
with open('PortList.txt', 'r') as infile:
for nextLine in infile:
lineList = nextLine.split()
keys = [lineList[0], lineList[1]]
values = [lineList[2]]
#this won't cover all of the words for the value, but for the test it's just for the first word
portDictionary[keys] = values