The purpose of this assignment is to learn how write basic scripts using the Python programming language.                 
math.sqrt
function: pydoc3 math.sqrt
Here is a program named “walk“. Your TA will discuss it.                 
#! /usr/bin/python3 import os for dirpath, directories, files in os.walk("."): for f in files: fpath = dirpath + '/' + f st = os.stat(fpath) mode = st.st_mode & 0o777 print("%o" % mode, fpath)
import
do?
os.walk
return?
0o777
mean?
%
operator do?
Copy & paste the script, above, to your system (beware of tabs) and make sure that you can execute it.                 
Add code to ignore files that begin with a dot, e.g., .bashrc
.
                
Add code to print the file protection bits in the style
of ls -l
, e.g., -rwxr-xr--
                
Add code to complain, to standard error, if the file is publicly readable, writable, or executable.                 
Add code to not complain (see above) if the file .public
exists in the same directory as the file that is publicly
readable/writable/executable.
                
Hey, we’re only listing plain files, not directories! Modify your program to also list directories.                 
Show the modification time for the files.                 
Show your work to the TA.                 
Modified: 2015-11-20T14:55                  User: Guest                  Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |