1. OS]
1. Rename: OS. Rename (old, new)
2. Delete: OS. Remove (file)
3. List the files in the directory: OS. listdir (PATH)
4. Get the current working directory: OS. getcwd ()
5. Change the working directory: OS. chdir (newdir)
6. Create a multilevel Directory: OS. makedirs (R "C:/Python/test ")
7. Create a single directory: OS. mkdir ("test ")
8. Delete multiple directories: OS. removedirs (R "C:/Python") # delete all empty directories in the last directory of the given path.
9. delete a single directory: OS. rmdir ("test ")
10. Get file attributes: OS. Stat (file)
11. Modify the File Permission and timestamp: OS. chmod (file)
12. Execute the operating system command: OS. System ("dir ")
13. Start a new process: OS .exe C (), OS .exe CVP ()
14. Execute the program in the background: osspawnv ()
15. Terminate the current process: OS. Exit (), OS. _ exit ()
16. Separated file name: OS. Path. Split (R "C:/Python/Hello. py") --> ("C: // Python", "Hello. py ")
17. separation Extension: OS. path. splitext (R "C:/Python/hello. PY ") --> (" C: // Python // hello ",". PY ")
18. Obtain the path name: OS. Path. dirname (R "C:/Python/Hello. py") --> "C: // Python"
19. Get the file name: OS. Path. basename (R "R:/Python/Hello. py") --> "Hello. py"
20. Determine whether the file exists: OS. Path. exists (R "C:/Python/Hello. py") --> true
21. Determine whether the path is absolute: OS. Path. isabs (R "./Python/") --> false
22. Check whether the directory is OS. Path. isdir (R "C:/Python") --> true
23. Determine whether the file is: OS. Path. isfile (R "C:/Python/Hello. py") --> true
24. Determine whether the file is a linked file: OS. Path. islink (R "C:/Python/Hello. py") --> false
25. Get file size: OS. Path. getsize (filename)
26. *******: OS. ismount ("C: //") --> true
27. Search all files in the directory: OS. Path. Walk ()
[2. shutil]
1. Copy a single file: shultil. Copy (oldfile, newfle)
2. Copy the entire directory tree: shultil. copytree (R "./setup", R "./backup ")
3. Delete the entire directory tree: shultil. rmtree (R "./backup ")
[3. tempfile]
1. Create a unique temporary file: tempfile. mktemp () --> filename
2. Open the temporary file: tempfile. temporaryfile ()
[4. stringio] # cstringio is a fast implementation module of the stringio module.
1. Create a memory file and write the initial data: F = stringio. stringio ("Hello world! ")
2. Read Memory file data: Print F. Read () # or print F. getvalue () --> Hello world!
3. Write Data to memory files: f. Write ("good day! ")
4. Close the memory file: f. Close ()
[5. glob]
1. Matching file: Glob. glob (R "C:/Python/*. py ")