Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pickle
- email = {'John':'John_Email@gmail.com', 'Sara':'Sara_Email@gmail.com', 'Harry':'Harry_Email@gmail.com'}
- file_mail = open('email.dat','wb')
- email = pickle.load(file_mail)
- file_mail.close()
- print(email)
- count = 0
- while count == 0:
- print('Add an email address: 1')
- print('Modify an email address: 2')
- print('Delete an email address: 3')
- print('Display a list: 4')
- choice = input('Enter a number from the list above:')
- if int(choice)== 1:
- name = input('Enter name:')
- mail = input('Enter e-mail address:')
- email[name] = mail
- print('Added Successfully')
- if int(choice) == 2:
- name = input('Enter name:')
- mail = input('Enter e-mail address:')
- email[name] = mail
- print('Modified Successfully')
- if int(choice) == 3:
- name = input('Enter name:')
- mail = input('Enter e-mail address:')
- email[name] = mail
- print('Deleted Successfully')
- if int(choice) == 4:
- print(email)
- else:
- print('Invalid Choice')
- c = input('Do you want to continue y/n: ')
- if c.upper() == 'N':
- count = 1
- print('Invalid Letter')
- file_mail = open('email.dat','wb')
- pickle.dump(email,file_mail)
- file_mail.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement