Advertisement
LusyanTheWhys

Binary file

Apr 18th, 2017
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import pickle
  2. class ultra:
  3.     def __init__(self,No,Na,K):
  4.         self.AgentNo=No
  5.         self.AgentName=Na
  6.         self.KCode=K
  7.  
  8. def Create():
  9.     Gamma=open("TOPSECRET.dat","wb")
  10.     print("enter information about top secret agents")
  11.     print("to exit, enter code") #terminator is "code"
  12.     Num=input("Enter Agent number:")
  13.     while Num!="code":
  14.         Name=input("Enter Agent name:")
  15.         Code=input("Enter agent kill code:")
  16.         x=ultra(Num,Name,Code)
  17.         pickle.dump(x,Gamma)
  18.         Num=input("Enter Agent number:")
  19.         x=ultra("","","")
  20.     Gamma.close()
  21. Create()
  22.  
  23. def Expose():
  24.     Gamma=open("TOPSECRET.dat","rb")
  25.     while True:
  26.         try:
  27.             x=pickle.load(Gamma)
  28.             print(x.AgentName)
  29.         except EOFError:
  30.             break
  31.     Gamma.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement