当前位置:网站首页>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'
边栏推荐
- Climb Phoenix Mountain on December 19, 2021
- XMIND installation
- Open the neural network "black box"! Unveil the mystery of machine learning system with natural language
- Object. Assign () & JS (= >) arrow function & foreach () function
- Interview and lecture summary 1
- Heartbeat error attempted replay attack
- [machine] [server] Taishan 200
- Postman advanced
- Regular expression
- Cacti主机模板之定制版
猜你喜欢

Canoe: what is vtsystem

Application and Optimization Practice of redis in vivo push platform

Digital simulation beauty match preparation -matlab basic operation No. 6

Canoe test: two ways to create CAPL test module
![[Galaxy Kirin V10] [server] system partition expansion](/img/49/5d3e28eab45d300bd5695e47b35e6b.jpg)
[Galaxy Kirin V10] [server] system partition expansion

Appscan installation error: unable to install from Net runtime security policy logout appscan solution

Personal thoughts on the development of game automation protocol testing tool
![[Galaxy Kirin V10] [server] iSCSI deployment](/img/60/13f43dc584c0768965d60811768948.jpg)
[Galaxy Kirin V10] [server] iSCSI deployment

Introduction to Lichuang EDA

Replace() function
随机推荐
[Galaxy Kirin V10] [server] NFS setup
XMIND installation
How to deal with the relationship between colleagues
Article publishing experiment
Iterator generators and modules
QQ get group link, QR code
Elevator dispatching (pairing project) ①
Unittest+airtest+beatiulreport combine the three to make a beautiful test report
[machine] [server] Taishan 200
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
Discussion | has large AI become autonomous? Lecun, chief scientist of openai
Canoe: what is vtsystem
[test theory] test phase analysis (unit, integration, system test)
Is Sanli futures safe? How to open a futures account? How to reduce the handling charge of futures at present?
Locust installation
Using SA token to solve websocket handshake authentication
Daemon xinted and logging syslogd
thread
Automatic translation between Chinese and English
Detailed array expansion analysis --- take you step by step analysis