You are being asked to create simple function to check for the existence of files in your
Question:
You are being asked to create simple function to check for the existence of files in your environment using a TRY...EXCEPT block. The list of files to check will be given. You need to create program to check files and output whether each file exists or not to an output file. You must ensure that the program runs and does not show any crashes to the user.
Grading
The assignment will be graded by instructor criteria list below. You may develop the code in any Python editor, but the code must run in Cengage environment. There is no automatic grading for this assignment. You will need to submit the assessment in Blackboard.
What you need to know
Read list of files from file: file_list.txt
The list of files is below, create and save this file in your python environment. This is text file with 9 lines and no header.
users.csv
suspended_accounts.csv
accidents.csv
ace_awards.csv
travel_costs.csv
business_expenses.csv
daily_visits.csv
class_list.csv
users_backup.csv
Check to see if the file exists or not in your environment.
Create simple function to attempt to open each file, and then if file opens then the file exists. If the file does not open, then catch the exception, and pass back result that the file does not exist.
You can read the file above into a list and then iterate through the list to check for existence of each file. Below is sample print statements to check status of development.
Output file name and exist status to CSV file
Output the list of file names and exist status to comma delimited file with header names: filename and exists. Write to a file output_list.csv with sample output as below.
filename,exists
users.csv,True
suspended_accounts.csv,False
accidents.csv,False
ace_awards.csv,False
travel_costs.csv,False
business_expenses.csv,False
daily_visits.csv,False
class_list.csv,True
users_backup.csv,False
Grading Criteria
This will be fully graded by the instructor.
Auditing a risk based approach to conducting a quality audit
ISBN: 978-1133939153
9th edition
Authors: Karla Johnstone, Audrey Gramling, Larry Rittenberg