Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

Use good transitions

Answered: 1 week ago