Browse Source
subprocess.run: encoding -> text=True
pull/111/head
谭九鼎
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
1 deletions
-
README.md
|
@ -1703,7 +1703,7 @@ import os |
|
|
#### Sends '1 + 1' to the basic calculator and captures its output: |
|
|
#### Sends '1 + 1' to the basic calculator and captures its output: |
|
|
```python |
|
|
```python |
|
|
>>> from subprocess import run |
|
|
>>> from subprocess import run |
|
|
>>> run('bc', input='1 + 1\n', capture_output=True, encoding='utf-8') |
|
|
|
|
|
|
|
|
>>> run('bc', input='1 + 1\n', capture_output=True, text=True) |
|
|
CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='') |
|
|
CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='') |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|