P
P
PythonBeginner202018-01-29 00:27:34
Python
PythonBeginner20, 2018-01-29 00:27:34

How to read data from python file?

The task is not difficult. But I don't know how to implement it.
I need to read a file that contains a username, password, and website in encrypted form. Something like this:
login:password:vk.com The
question is how best I can read the login, password and site from Python and then use this information in the code. For example, decrypt and display (conditional task).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
artem78, 2018-01-29
@PythonBeginner20

with open('passwords.txt', 'r') as f:
    for line in f:
        line = line.strip()
        login, password, domain = line.split(':')
        print('login: %s, pass: %s, domain: %s' % (login, password, domain))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question