-
외부 파일을 실행하고 출력 확인
System
>>> import os >>> r = os.popen("dir *.exe").read() The system cannot find the path specified. >>> r ' Volume in drive C is VdW7u\n Volume Serial Number is 0000-0000\n\n Directory o f C:\\Python38\n\n2020-07-20 16:03 100,424 python.exe\n2020-07-20 16 :03 98,888 pythonw.exe\n 2 File(s) 199,312 bytes \n 0 Dir(s) 8,375,424 bytes free\n'
Subprocess
>>> import subprocess >>> r = subprocess.Popen("xcopy.exe", stdout=subprocess.PIPE, stderr=subproce ss.PIPE) >>> r.communicate() (b'0 File(s) copied\r\n', b'Invalid number of parameters\r\n')
'Python' 카테고리의 다른 글
가변 파라미터 (0) 2022.07.23 컴프리헨션(Comprehension) (0) 2022.07.23 Class (클래스) (0) 2021.11.11 Flask - Android환경에 Java와 연동 (0) 2021.10.25 Python Sandbox (0) 2021.06.23 Opencv 윤곽 검출 (0) 2021.04.12 Opencv boundingRect (0) 2021.04.12 Python ScikitLearn 손글씨 숫자 인식 2 (0) 2021.04.12