当前位置:网站首页>Properties and methods of OS Library
Properties and methods of OS Library
2022-07-04 11:07:00 【It's a cinch!】
chdir: Modify working directory ——os.chdir(“path”)
curdir: Get the current directory , Return to relative path ——os.curdir
getcwd: View current directory , Return to absolute path ——os.getcwd()
chmod: Modify file or directory permissions ——os.chmod(path.mode)
cpu_count: return cpu Number of threads corresponding to the core (2 nucleus 4 Threads )——os.cpu_count()
close: Close file path ——os.close(path)
kill: Kill process by process number ( Use with caution )——os.kill(pid, sig)
getpid: Get the current process number ——os.getpid()
getppid: Returns the parent process number of the current process —— os.getppid()
linesep: Displays the newline character under the current system ——os.linesep
sep: Get the current path delimiter ——os.sep
pathsep: Get the environment variable delimiter ——os.pathsep
listdir: Return all files in the corresponding directory , Including hidden files ——os.listdir(path)
makedirs: Create directory ( It can support multi-level directories )——os.makedirs(path)
mkdir: Create directory It can only be one floor ——os.mkdir(path)
open: create a file ——file = os.open(‘filename,‘ File format ’,‘w’)
remove: Delete file ——os.remove(" file name ")
removedirs: Delete directory , Support multi-level deletion ——os.removedirs(path)
system: Execute terminal commands , stay cmd The output content will be output directly on the console , The return result is 0 Indicates successful execution ——os.system() Such as , Clear screen operation os.system(cls)
notes :os.system It's simple and rough execution cmd Instructions , If you want to get cmd Output content , You can't get it
'DirEntry', 'F_OK', 'MutableMapping', 'O_APPEND', 'O_BINARY', 'O_CREAT', 'O_EXCL', 'O_NOINHERIT', 'O_RANDOM', 'O_RDONLY', 'O_RDWR', 'O_SEQUENTIAL', 'O_SHORT_LIVED', 'O_TEMPORARY', 'O_TEXT', 'O_TRUNC', 'O_WRONLY', 'P_DETACH', 'P_NOWAIT', 'P_NOWAITO', 'P_OVERLAY', 'P_WAIT', 'PathLike', 'R_OK', 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'W_OK', 'X_OK', '_AddedDllDirectory', '_Environ', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_execvpe', '_exists', '_exit', '_fspath', '_get_exports_list', '_putenv', '_unsetenv', '_wrap_close', 'abc', 'abort', 'access', 'add_dll_directory', 'altsep', 'closerange', 'defpath', 'device_encoding', 'devnull', 'dup', 'dup2', 'environ', 'error', 'execl', 'execle', 'execlp', 'execlpe', 'execv', 'execve', 'execvp', 'execvpe', 'extsep', 'fdopen', 'fsdecode', 'fsencode', 'fspath', 'fstat', 'fsync', 'ftruncate', 'get_exec_path', 'get_handle_inheritable', 'get_inheritable', 'get_terminal_size', 'getcwdb', 'getenv', 'getlogin', 'isatty', 'link', 'lseek', 'lstat', '', 'name', 'pardir', 'path', 'pipe', 'popen', 'putenv', 'read', 'readlink','rename', 'renames', 'replace', 'rmdir', 'scandir', 'set_handle_inheritable', 'set_inheritable', 'spawnl', 'spawnle', 'spawnv', 'spawnve', 'st', 'startfile', 'stat', 'stat_result', 'statvfs_result', 'strerror', 'supports_bytes_environ', 'supports_dir_fd', 'supports_effective_ids', 'supports_fd', 'supports_follow_symlinks', 'symlink', 'sys', 'terminal_size', 'times', 'times_result', 'truncate', 'umask', 'uname_result', 'unlink', 'urandom', 'utime', 'waitpid', 'walk', 'write'
边栏推荐
- Discussion | has large AI become autonomous? Lecun, chief scientist of openai
- Getting started with window functions
- Elevator dispatching (pairing project) ①
- [Galaxy Kirin V10] [server] failed to start the network
- [Galaxy Kirin V10] [server] FTP introduction and common scenario construction
- [testing theory] thinking about testing profession
- Appscan installation steps
- 2022 ape circle recruitment project (software development)
- Locust installation
- Analysis function in SQL
猜你喜欢
[Galaxy Kirin V10] [server] failed to start the network
Notes on writing test points in mind mapping
Canoe - the third simulation project - bus simulation - 3-1 project implementation
[Galaxy Kirin V10] [desktop] printer
Appscan installation steps
Learning XML DOM -- a typical model for parsing XML documents
[Galaxy Kirin V10] [desktop] cannot add printer
Oracle11g | getting started with database. It's enough to read this 10000 word analysis
Analysis function in SQL
Send a request using paste raw text
随机推荐
Customized version of cacti host template
[Galaxy Kirin V10] [server] soft RAID configuration
Oracle11g | getting started with database. It's enough to read this 10000 word analysis
Installation of ES plug-in in Google browser
Understanding of object
[Galaxy Kirin V10] [server] system startup failed
Regular expression
SSH principle and public key authentication
3W word will help you master the C language as soon as you get started - the latest update is up to 5.22
[Galaxy Kirin V10] [server] NUMA Technology
array_ The contains() function uses
[Galaxy Kirin V10] [server] grub default password
Using SA token to solve websocket handshake authentication
Article publishing experiment
VI text editor and user rights management, group management and time management
Elevator dispatching (pairing project) ①
Climb Phoenix Mountain on December 19, 2021
[Galaxy Kirin V10] [desktop] FTP common scene setup
Canoe: distinguish VT, VN and vteststudio from their development history
Elevator dispatching (pairing project) ③