Instructions: NOTE: Make sure to fully read the instructions before starting With this file you will find a handful of files ending in .txt containing the following data: schedule.txt: A table containing applications, command line flags, start times, stop times, whether the application is enabled, and the days of the week the application runs. Days of the week are read as follows: 1,4-7 = Sunday, Wednesday, Thursday, Friday, Saturday *     = Every day of the week apps#.txt: A date to consider and an unsorted list of application names example.txt: Example output for apps1.txt Create a Python 3 program that does the following: 1.  Takes the path to a schedule file, the path to an app file, and the path to an output file as command line arguments 2.  Writes a csv of the applications that would run on the date in the app file as well as their options, start times, and stop times For example, executing the following should result in a file similar to example.txt: python3 script.py schedule.txt apps1.txt example.txt You can assume the apps files will never contain an application that is not present in the schedule file and that

the schedule file will always contain all the necessary information for each application.

To accomplish this task, I would suggest the following approach:

1. Read the contents of the schedule file (schedule.txt) and store them in a suitable data structure, such as a dictionary or a list of dictionaries. Each dictionary representing an application should contain the relevant information, such as application name, command line flags, start times, stop times, whether the application is enabled, and the days of the week the application runs.

2. Read the contents of the app file (apps1.txt) and extract the date mentioned. This will be used to filter applications that should run on that specific date.

3. Iterate over the applications in the schedule and check if they should run on the date mentioned in the app file. If an application meets the criteria, extract its details, such as options, start times, and stop times.

4. Write the extracted data to the output file (example.txt) in CSV format. Each row should represent an application and contain its details.

Here is an example code snippet to give you an idea of how to implement this:

“`python
import csv

def extract_applications(schedule_file, app_file, output_file):
schedule = read_schedule_file(schedule_file)
date = extract_date_from_app_file(app_file)

applications_to_run = []
for app in schedule:
if should_run_on_date(app, date):
application_details = extract_application_details(app)
applications_to_run.append(application_details)

write_to_csv(output_file, applications_to_run)

def read_schedule_file(schedule_file):
schedule = []
with open(schedule_file, ‘r’) as file:
for line in file:
# Parse each line of the schedule file and add it to the schedule list
# You can consider using the csv module to handle the parsing
application_details = parse_line(line)
schedule.append(application_details)

return schedule

# Other helper functions…

extract_applications(‘schedule.txt’, ‘apps1.txt’, ‘example.txt’)
“`

Please note that the code snippet above is a simplified example and may require modification to fit your specific needs. You will need to implement the helper functions mentioned, such as `extract_date_from_app_file`, `should_run_on_date`, `extract_application_details`, and `write_to_csv`, based on your data structure and desired output format.

Additionally, don’t forget to handle any potential errors or edge cases that may arise, such as file not found errors or invalid data in the input files.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer