Question: Complete the script below to do the following: IN PYTHON Add your name, date, assignment number to the top of this script Using the os
Complete the script below to do the following: IN PYTHON
Add your name, date, assignment number to the top of this script
Using the os library and the oswalk method
a Create a list of all files
b Create an empty dictionary named fileHashes
c Iterate through the list of files and
calculate the md hash of each file
create a dictionary entry where:
key md hash
value filepath
d Iterate through the dictionary
print out each key, value pair
import os
import hashlib
directory
fileList
fileHashes
for root, dirs, files in oswalkdirectory:
# Walk the path from top to bottom.
# For each file obtain the filename
for fileName in files:
path ospath.joinroot fileName
fullPath ospath.abspathpath
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
