Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. class Account:
  2.     def __init__(self, email, passw):
  3.         self.email = email
  4.         self.passw = passw
  5.  
  6.  
  7. class AccountLoader:
  8.     def __init__(self):
  9.         self.accounts = []
  10.  
  11.     @staticmethod
  12.     def parse_line_to_account(line):
  13.         _line = line.split(':')
  14.         return _line[0], _line[1]
  15.  
  16.     def load_accounts_from_file(self):
  17.         _accounts_list = [line.strip() for line in open('accounts.txt')]
  18.         for _account in _accounts_list:
  19.             self.accounts.append(Account(*self.parse_line_to_account(_account)))
  20.  
  21. al = AccountLoader()
  22. al.load_accounts_from_file()
  23. for acc in al.accounts:
  24.     print(acc.email, acc.passw)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement