This commit is contained in:
2021-11-14 15:52:46 +08:00
parent 915c231124
commit 1e344dc204
112 changed files with 1039 additions and 1039 deletions

View File

@@ -6,7 +6,7 @@ tags: ["python", "shell"]
categories: ["python"]
---
# os
## os
- 阻塞返回shell执行参数命令的状态,即成功返回0
```python
os.system('cat /proc/cpuinfo')
@@ -16,7 +16,7 @@ categories: ["python"]
os.popen('cat /proc/cpuinfo')
```
# commands
## commands
- 阻塞,返回参数指定的系统文件的详细属性
```python
commands.getstatus('/proc/cputinfo')
@@ -30,7 +30,7 @@ categories: ["python"]
commands.getstatusoutput('cat /proc/cpuinfo')
```
# subprocess
## subprocess
- 阻塞返回shell状态禁用 PIPE 参数
```python
subprocess.call(args, *, stdin=None, stdout=None, stderr=None, shell=False)
@@ -44,7 +44,7 @@ categories: ["python"]
subprocess.check_output(args, *, stdin=None, stderr=None, shell=False, universal_newlines=False)
```
# Pope
## Pope
- 不阻塞返回Popen对象
```python
subprocess.Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0)