Advertisement
Ruslan11121

Untitled

Oct 23rd, 2019
1,327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pickle
  2.  
  3. Base = 'Base.data'
  4. humans = {}
  5.  
  6. def create_human(name, email):
  7.     humans[name] = email
  8.    
  9.  
  10.  
  11.  
  12. def print_email(name):
  13.     f = open(Base, 'r')
  14.     humans = pickle.load(f)
  15.     print(humans[name])
  16.     f.close()
  17.  
  18.  
  19. def delete_user(name):
  20.     f = open(Base, 'wb')
  21.     lines = f.readlines()
  22.     del lines[name]
  23.     f.close()
  24.  
  25.  
  26. def foo(name):
  27.     f = open(Base, 'rb')
  28.     humans = pickle.load(f)
  29.  
  30.     if name in lines:
  31.         print('Такой человек есть.')
  32.     else:
  33.         print('Такого человека нет.')
  34.     f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement