-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinary reading.py
More file actions
27 lines (25 loc) · 842 Bytes
/
binary reading.py
File metadata and controls
27 lines (25 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pickle
class Account(): #every user will have an object of this class
def __init__(self, FirstName, LastName, DOB, Password, Username ):
self.FirstName = FirstName
self.LastName = LastName
self.DOB = DOB
self.Password= Password
self.Username = Username
self.Highscore = 0
def display(self):
print ("Username: ", self.Username)
print ("Password: ", self.Password)
print ("Highscore: ", self.Highscore)
file=open('Accounts.dat','rb')
if not file:
print ('error')
else:
while True:
try:
x=pickle.load(file)
x.display()
except EOFError:
print ('That is all')
break
file.close()