PW Akshay


generate functionFri, 02 Dec 2022

Create a CSV file by entering user-id and password, read and search the password for given user id

import csv def create_csv_file(): csv_columns = ['user id', 'password'] try: with open('user_pass.csv', 'w') as csvfile: writer = csv.DictWriter(csvfile, fieldnames=csv_columns) writer.writeheader() user_id = input('Enter user id: ') password = input('Enter password: ') writer.writerow({'user id': user_id, 'password': password}) except IOError: print("I/O error")

Questions about programming?Chat with your personal AI assistant