file = open(selection, 'r')
dict = {}
with open(selection, 'r') as f:
for line in f:
items = line.split()
key, values = items[0], items[1:]
dict[key] = values
englishWord = dict.keys()
spanishWord = dict.values()
Hello, I am working on a project where I have an file with spanish and english words. I am trying to take these words, and put them into a dictionary. The file looks like this:
library, la biblioteca
school, la escuela
restaurant, el restaurante
cinema, el cine
airport, el aeropuerto
museum, el museo
park, el parque
university, la universidad
office, la oficina
house, la casa
Every time I run the code, I get an error about the range. What am I doing wrong?
'library, la biblioteca'will be split?