I have the following code
def retrieve_user(username):
with open(users_file, 'r', encoding='utf-8') as f:
items = []
line_num = 0
for line in f:
line_num = line_num+1
#print(items)
if line_num > 1:
items = line.split(';')
name = items[0]
area = items[1]
all_keywords = items[2].split('$')
if name in user.keys():
user[name].append([area, all_keywords])
else:
user[name] = [area, all_keywords]
if username in user.keys():
print(user[username])
else:
print('User ', username, ' could not be found')
login_user()
return False
and now i get the following error. does anybody knows why? I have stuck and i don't know what I am doing wrong.
**area = items[1]
IndexError: list index out of range**
the file that i am trying to retrieve the data looks like this
user;area;keywords
mike;Sports: Football;Arsenal
john;Technology: IBM;CPU
thank you in advance