Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Account:
- def __init__(self, email, passw):
- self.email = email
- self.passw = passw
- class AccountLoader:
- def __init__(self):
- self.accounts = []
- @staticmethod
- def parse_line_to_account(line):
- _line = line.split(':')
- return _line[0], _line[1]
- def load_accounts_from_file(self):
- _accounts_list = [line.strip() for line in open('accounts.txt')]
- for _account in _accounts_list:
- self.accounts.append(Account(*self.parse_line_to_account(_account)))
- al = AccountLoader()
- al.load_accounts_from_file()
- for acc in al.accounts:
- print(acc.email, acc.passw)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement