Cannot correctly encode string when reading from text file (encoding into sha256…)

Basically what I want to accomplish (simplified...):

I want to make 100 bitcoin addresses from my own password that look kind of like:

password_1 password_2 password_3

So when I do this in the program, I am getting the correct result:

def public_key(src):
    privatekey = (int(hashlib.sha256(src).hexdigest(), 16))
    return generate_address(privatekey)
def private_key(src):
    privatekey = hashlib.sha256(src).hexdigest()
    return str(privatekey)
herewego = "password_1".encode('utf-8')
somevariable = public_key(herewego)
print somevariable 

^ This works as intended...but if I put "password_1" in a txt file and try to read this line, it gives totally different result?

for addr in file:
 address =  addr.encode('utf-8')
 print public_key(address)

So the issue is obviously that Notepad encodes the text file in say ansi or utf-8, it doesn't matter but the line read from there must be looking different to python than when I enter the " ...." within python? So what coding to use or if it's impossible: what alternative to Notepad? This is for Python 2.7 in windows by the way.

#blockchain #bitcoin #python

2.40 GEEK