I have txt file with two columns:
user1 1
user2 2
user3 3
user4 4
user5 5
So, I read columns to dictionary:
def read_users(filename):
users = {}
with open('1.txt', 'r') as f:
for line in f:
words = line.split()
users[words[0]] = words[1]
return users
Function returns the following dictionary:
{'user4':'4'}; {'user5':'5'}; {'user1':'1'}; {'user2':'2'}; {'user3':'3'}
Why does it begin with user4? It should be from user1 to user5. Order of strings in file is correct.