day 14- python directory operations

An import module

os module and os.path

 

Two related functions

 

 

Three examples

1 getcwd () returns the current working directory

 

 

2 os.path.abspath (filename or directory) to obtain the absolute path

 

 

 

3 determines whether a directory os.path.exists (determination directory) exist

 

 

4 Create a directory os.mkdir (path + filename)

 

 

 

5 delete the directory os.rmdir (path + filename)

 

 

6 directory traversal 

Guess you like

Origin www.cnblogs.com/lucky-sunshine/p/12035288.html