Answered step by step
Verified Expert Solution
Question
1 Approved Answer
trying to move a zipped file (aggregate_complaints_001.zip) from the desktop to a folder within a directory. Specifically the zip_archives_directory. if not os.path.exists(directory): #checks to see
trying to move a zipped file (aggregate_complaints_001.zip) from the desktop to a folder within a directory. Specifically the zip_archives_directory.
if not os.path.exists(directory): \#checks to see if the directory is there, if not it creates them os.makedirs (directory) \#makedirs allows for them all to be created at the same time not nested for filename in os. Listdir (processing dir) : \#moves files from processing to archives source = os.path.join (processing dr, filename) destination = os.path.join (file archives, filename) shutil. move (source, destination) for filename in os.listdir (file archives_dir) \#oreates zip files for files in archive if filename. endwith (". csv") : zip.write (filepath, arcname=filename) with open ('complaints master.csv','W') as storage:\#creates csv file with headers storage. Write ('Complaint ID, Date Received, Company, Product, Issue n')
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