Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 정규식 활용
- gcc regex
- 정규식 컴파일
- c3 step graph
- python subprocess
- subporcess path
- snmp
- selinux port 등록
- c3 초
- semanage
- gcc 업데이트
- regex_search
- CentOS7
- 백준
- snmp test
- linux시간으로 변경
- c3 축 없애기
- InfluxDB
- influxdb 설치
- c3 second
- telegraf
- 1697
- c3 축 가리기
- python os
- python popen
- 정규식 문자열 출력
- centos pyhon 설치
- c++ 정규식
- grafana dashboard
- g++ 업데이트
Archives
- Today
- Total
리셋 되지 말자
[python 활용] subprocess 본문
python에서 c언어의 popen를 유사하게 쓰기위해 'import os'를 사용하는데,
subprocess도 있다. 코드먼저 살펴보면,
import subprocess
#'ls'명령어를 실행한 결과를 utf-8타입으로 out에 저장
out = subprocess.check_output(['ls /'], shell=True, encoding='utf-8')
#out출력
print(out)
실행 결과
'/' 디렉토리에 있는 파일들이 나란히 출력되었다.
'Python' 카테고리의 다른 글
[python 활용]파이썬 모듈로 웹서버 구축하기 (0) | 2020.08.24 |
---|---|
[python 공부] 아스키코드->문자, 문자->아스키코드 (0) | 2020.08.10 |
[python 공부] set의 remove, discard 비교 (0) | 2020.08.10 |
[python 활용] websocket으로 json 송신, 수신 하기 (0) | 2020.04.08 |
[python 활용] subprocess 활용 (0) | 2020.03.24 |
Comments