SlideShare a Scribd company logo
1 of 1
Download to read offline
Hi! I'm currently working on my python assignment and I'm stuck.
# Import os, shutil, zipfile, and logging
import os, shutil, zipfile, logging
# Print the current working directory. If you are not in the test directory
# from D2L, you need to change directory into test.
# Use either an absolute or relative path
print(os.getcwd())
os.chdir("test/")
# Enable logging for DEBUG messages.
# Change the name of file to "Debug.txt" and place it in the parent folder
# Pass the FORMAT and FILE below.
FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
FILE = 'Debug.txt'
logging.basicConfig(level=logging.DEBUG, format = FORMAT, filename = 'Debug.txt')
# write that the program has started as a DEBUG message.
logging.debug('This program has started with a debug.')
# Create a zip file in the parent folder and name it: Test2.
# Now you need to write everything from Test into the Test2 zip file.
# HINT: I use the statement below to log
# the rel path of all the files in test
# maybe you can write to the zip file in the same loop?
for folder, subfolder, files in os.walk('.'):
for file in files:
logging.info('Writing File: ' + str(os.path.join(folder, file)))
#zip_file.write(os.path.join(folder, file))
# Close your zip file
# Write a log that the program has ended
#-----------------------------------------------------------------------
# End Banner
print()
print()
print('--------------------------------'.center(60))
print('--- End Exercise ---'.center(60))
print('--------------------------------'.center(60))

More Related Content

Similar to Hi Im currently working on my python assignment and Im st.pdf

Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
Gabriele Lana
 
CommandLineBasics.pdf
CommandLineBasics.pdfCommandLineBasics.pdf
CommandLineBasics.pdf
asvdx
 
ProgFund_Lecture_6_Files_and_Exception_Handling-3.pdf
ProgFund_Lecture_6_Files_and_Exception_Handling-3.pdfProgFund_Lecture_6_Files_and_Exception_Handling-3.pdf
ProgFund_Lecture_6_Files_and_Exception_Handling-3.pdf
lailoesakhan
 
IN C++ languageWrite a simple word processor that will accept text.pdf
IN C++ languageWrite a simple word processor that will accept text.pdfIN C++ languageWrite a simple word processor that will accept text.pdf
IN C++ languageWrite a simple word processor that will accept text.pdf
aratextails30
 

Similar to Hi Im currently working on my python assignment and Im st.pdf (20)

Diploma ii cfpc- u-5.2 pointer, structure ,union and intro to file handling
Diploma ii  cfpc- u-5.2 pointer, structure ,union and intro to file handlingDiploma ii  cfpc- u-5.2 pointer, structure ,union and intro to file handling
Diploma ii cfpc- u-5.2 pointer, structure ,union and intro to file handling
 
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
 
Metadata-driven Testing
Metadata-driven TestingMetadata-driven Testing
Metadata-driven Testing
 
Devtools cheatsheet
Devtools cheatsheetDevtools cheatsheet
Devtools cheatsheet
 
Devtools cheatsheet
Devtools cheatsheetDevtools cheatsheet
Devtools cheatsheet
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 
Weapons for Boilerplate Destruction
Weapons for Boilerplate DestructionWeapons for Boilerplate Destruction
Weapons for Boilerplate Destruction
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
Unit_V_Files handling in c programming language.pptx
Unit_V_Files handling in c programming language.pptxUnit_V_Files handling in c programming language.pptx
Unit_V_Files handling in c programming language.pptx
 
File management
File managementFile management
File management
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
Advance C Programming UNIT 4-FILE HANDLING IN C.pdfAdvance C Programming UNIT 4-FILE HANDLING IN C.pdf
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
 
Pythonpresent
PythonpresentPythonpresent
Pythonpresent
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
OS_lab_file.pdf
OS_lab_file.pdfOS_lab_file.pdf
OS_lab_file.pdf
 
CommandLineBasics.pdf
CommandLineBasics.pdfCommandLineBasics.pdf
CommandLineBasics.pdf
 
ProgFund_Lecture_6_Files_and_Exception_Handling-3.pdf
ProgFund_Lecture_6_Files_and_Exception_Handling-3.pdfProgFund_Lecture_6_Files_and_Exception_Handling-3.pdf
ProgFund_Lecture_6_Files_and_Exception_Handling-3.pdf
 
C tutorial
C tutorialC tutorial
C tutorial
 
IN C++ languageWrite a simple word processor that will accept text.pdf
IN C++ languageWrite a simple word processor that will accept text.pdfIN C++ languageWrite a simple word processor that will accept text.pdf
IN C++ languageWrite a simple word processor that will accept text.pdf
 
File handling in cpp
File handling in cppFile handling in cpp
File handling in cpp
 

More from geetakannupillai1

Highlight the correct answer i have tried myself Pleas.pdf
Highlight the correct answer   i have tried myself   Pleas.pdfHighlight the correct answer   i have tried myself   Pleas.pdf
Highlight the correct answer i have tried myself Pleas.pdf
geetakannupillai1
 
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfhhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
geetakannupillai1
 
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdfHere is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
geetakannupillai1
 
Here is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfHere is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdf
geetakannupillai1
 
here is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdfhere is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdf
geetakannupillai1
 
Here is The code in C language .pdf
Here is The code in C language  .pdfHere is The code in C language  .pdf
Here is The code in C language .pdf
geetakannupillai1
 
Here is the remaining question of the case study Under the .pdf
Here is the remaining question of the case study  Under the .pdfHere is the remaining question of the case study  Under the .pdf
Here is the remaining question of the case study Under the .pdf
geetakannupillai1
 

More from geetakannupillai1 (20)

Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdfHidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
 
Hi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdfHi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdf
 
Highlight the correct answer i have tried myself Pleas.pdf
Highlight the correct answer   i have tried myself   Pleas.pdfHighlight the correct answer   i have tried myself   Pleas.pdf
Highlight the correct answer i have tried myself Pleas.pdf
 
High involvement and low involvement marketing Point Di.pdf
High involvement and low involvement marketing Point  Di.pdfHigh involvement and low involvement marketing Point  Di.pdf
High involvement and low involvement marketing Point Di.pdf
 
Hi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdfHi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdf
 
help please Please respond to this post by choosing any o.pdf
help please  Please respond to this post by choosing any o.pdfhelp please  Please respond to this post by choosing any o.pdf
help please Please respond to this post by choosing any o.pdf
 
Hi There Please help me with 1 The python code AND .pdf
Hi There   Please help me with 1 The python code  AND .pdfHi There   Please help me with 1 The python code  AND .pdf
Hi There Please help me with 1 The python code AND .pdf
 
Hi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdfHi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdf
 
Hi Experts Could some one please explain with a practical e.pdf
Hi Experts  Could some one please explain with a practical e.pdfHi Experts  Could some one please explain with a practical e.pdf
Hi Experts Could some one please explain with a practical e.pdf
 
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfhhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
 
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
Heteraride st ynetimin rol  Soru seenekleri    1  kat.pdfHeteraride st ynetimin rol  Soru seenekleri    1  kat.pdf
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
 
Herzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdfHerzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdf
 
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdfHerhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
 
Help with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdfHelp with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdf
 
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdfHere is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
 
Here is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfHere is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdf
 
here is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdfhere is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdf
 
Here is The code in C language .pdf
Here is The code in C language  .pdfHere is The code in C language  .pdf
Here is The code in C language .pdf
 
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdfHelper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
 
Here is the remaining question of the case study Under the .pdf
Here is the remaining question of the case study  Under the .pdfHere is the remaining question of the case study  Under the .pdf
Here is the remaining question of the case study Under the .pdf
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Hi Im currently working on my python assignment and Im st.pdf

  • 1. Hi! I'm currently working on my python assignment and I'm stuck. # Import os, shutil, zipfile, and logging import os, shutil, zipfile, logging # Print the current working directory. If you are not in the test directory # from D2L, you need to change directory into test. # Use either an absolute or relative path print(os.getcwd()) os.chdir("test/") # Enable logging for DEBUG messages. # Change the name of file to "Debug.txt" and place it in the parent folder # Pass the FORMAT and FILE below. FORMAT = '%(asctime)s - %(levelname)s - %(message)s' FILE = 'Debug.txt' logging.basicConfig(level=logging.DEBUG, format = FORMAT, filename = 'Debug.txt') # write that the program has started as a DEBUG message. logging.debug('This program has started with a debug.') # Create a zip file in the parent folder and name it: Test2. # Now you need to write everything from Test into the Test2 zip file. # HINT: I use the statement below to log # the rel path of all the files in test # maybe you can write to the zip file in the same loop? for folder, subfolder, files in os.walk('.'): for file in files: logging.info('Writing File: ' + str(os.path.join(folder, file))) #zip_file.write(os.path.join(folder, file)) # Close your zip file # Write a log that the program has ended #----------------------------------------------------------------------- # End Banner print() print() print('--------------------------------'.center(60)) print('--- End Exercise ---'.center(60)) print('--------------------------------'.center(60))