Question
For this interactive assignment, you will apply all the concepts you learned in previous weeks and apply the use of sequential input and output operations
For this interactive assignment, you will apply all the concepts you learned in previous weeks and apply the use of sequential input and output operations to add two new functionalities to your Employee Management System.
Export employees information to text file: This functionality will allow the user to save the employee information saved in the list to the file system. Each list entry should be saved into a new line. You may notice by now that closing the script will cost your Employee Management System to lose all entered employees information. Exporting the current system data into a file system will help you to save this information permanently on the hard disk and be able to use it at later time.
Import employees information from text file: This functionality will help you to import preexisting employee information from a text file saved on the file system. Each line in the text should be saved as a new list entry. When you run your Employee Management System for the first time you should be able to populate the system with preexisting employee information, if there are any, instead of adding this information manually to the system.
****Can't seem to get the importEmployee function working correctly. It will not save the information to the lists*****
def exportEmployee():
import csv with open('empinfo.csv', 'w') as output: employee_writer = csv.writer(output) employee_writer.writerows([employeeName_List, employeeSSN_List, employeePhone_List, employeeEmail_List, employeeSalary_List]) print(" Employees record exported to file. ") mainMenu()
def importEmployee():
import csv f = open('empinfo.csv') data = [] for line in f: data_line = line.rstrip().split(',') data.append(data_line) employeeName_List = data[0] employeeSSN_List = data[1] employeePhone_List = data[2] employeeEmail_List = data[3] employeeSalary_List = data[4] print("Employee records imported from file. ") print(*employeeName_List, sep = ', ') print(*employeeSSN_List, sep = ', ') print(*employeePhone_List, sep = ', ') print(*employeeEmail_List, sep = ', ') print(*employeeSalary_List, sep = ', ') mainMenu()
mainMenu()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started