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

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

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

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

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Adding Messages On The Bitcoin Blockchain - A How-To Guide

Can I write on a Bitcoin Blockchain? Can I drop down a message? Yes, Luca of course you can! You can leave a message on a Bitcoin blockchain using a particular op code, called OP_RETURN.

What Is The Difference Between Blockchain And Bitcoin?

Our Blockchain Online Training will provide you to learn about Blockchain technology aspects with realty. Our Blockchain Course also includes live sessions, live Projects

Basic Data Types in Python | Python Web Development For Beginners

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.

What Is The Difference Between Blockchain And Bitcoin?

Get hands on experinece on block chain live industry experts with real world example at Block chain online Training. Enroll for free demo

How To Compare Tesla and Ford Company By Using Magic Methods in Python

Magic Methods are the special methods which gives us the ability to access built in syntactical features such as ‘<’, ‘>’, ‘==’, ‘+’ etc.. You must have worked with such methods without knowing them to be as magic methods. Magic methods can be identified with their names which start with __ and ends with __ like __init__, __call__, __str__ etc. These methods are also called Dunder Methods, because of their name starting and ending with Double Underscore (Dunder).