How do we assign a dictionary a name that is taken from input from the user and save that dictionary to a txt file so that we can search for it by its name and print output to the user? I am currently here:
Any ideas how?
import sys
import pathlib
'''Arg-V's should be in following order <app.py> <action> <nick_name> <name> <phone> <email>'''
if str(sys.argv[1]).lower == 'add':
current = {'Name': sys.argv[3], 'Phone Number': sys.argv[4], 'Email': sys.argv[5]}
with open('contacts.txt', 'w') as f:
f.write(current)