One, OS platform programming requirements
1. Operation of directory files
How to manipulate the system directory and file
2, the timing of the implementation of the program
3, the conversion of the executable program
The conversion of a Python program to an executable program
Second, the directory file operation
Root: current directory;
Dirs: Folders in the current directory
Files: File name under current directory
1 ImportOS2Path =input ("Path:")3 forRoot,dirs,filesinchOs.walk (path):4 Print(Root,"\ n")5 Print(Dirs,"\ n")6 Print(Files,"\ n")
1 ImportOS2Path =input ("Path:")3 forAinchOs.walk (path):4 Print(A[0],"\ n")5 Print(A[1],"\ n")6 Print(A[2],"\ n")
The following program returns an absolute path
1 Import OS 2 Path =input (" path:")3 for in Os.walk (path):4for in files:5 Print (Os.path.join (Root,name)
Python--os Platform Programming