Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Mail:
- def __init__(self):
- self.nadawca = 'brak'
- self.odbiorca = 'brak'
- self.data = 'brak'
- self.tytul = 'brak'
- self.tresc = 'brak'
- def show_mail(self):
- print('Pokazuje maila')
- print('nadawca: %s' % self.nadawca)
- print('odbiorca: %s' % self.odbiorca)
- print('data: %s' % self.data)
- print('tytul: %s' % self.tytul)
- print('tresc: %s' % self.tresc)
- def load_mail(self, path_to_file):
- with open(path_to_file, 'rb') as file1:
- for index, line in enumerate(file1):
- # utf8 decoding
- line = line.decode('utf8', 'ignore')
- splitted = line.split(':', 1)
- if index == 0:
- self.nadawca = splitted[1]
- if index == 1:
- self.odbiorca = splitted[1]
- if index == 2:
- self.data = splitted[1]
- if index == 3:
- self.tytul = splitted[1]
- if index == 4:
- self.tresc = splitted[1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement