Files to dictionaries (answered)
file = open ("pmoney.py","w") file.write("TLTF /n $500 /n Sens /n $300 /n Rawk /n $900") #example file created try: file = open("pmoney.py","r") temp = 0 mykeys = [] myvals = [] money = {} x = 0 #opened file and set a few variables for use later for line in file: if temp == 0: mykeys.append(line) temp =+ 1 elif temp == 1: myvals.append(line) temp =- 1 #takes each line of the file and appends it to #either a list for keys or a list for values, this goes #back and forth between them for word in mykeys: money[word] = myvals[x] x =+ 1 #takes each item in the list of keys then pairs it #with the item in the values list. We use x to make #sure key 0 is with value 0, then we increase x to #move to the next value when keys automatically #moves forward. finally: file.close() print(money) I receive an index error when this is run, and I'm honestly not sure why, since mykeys and myvals should have...