my_dict = {}
with open('myFile.txt', 'r') as f:
new_file = []
for line in f:
name_and_pass = line.split(":")
name = name_and_pass[0]
password = name_and_pass[1]
"""password = hash_passwd(password)"""
my_dict.update({name : password})
new_name_and_pass = name + ":" + password
with open("output.txt", 'a+') as out:
out.write(new_name_and_pass + os.linesep)
the file says: Yossi:123 dui50000!!:aaa#### username3:secretPass8 AVI8#:abc
in the dictionary every password for no reason saves with \n at the end: {'Yossi': '123\n', 'dui50000!!': 'aaa####\n', 'username3': 'secretPass8\n', 'AVI8#': 'abc'}