19
바이트를 문자열로 변환
이 코드를 사용하여 외부 프로그램에서 표준 출력을 얻습니다. >>> from subprocess import * >>> command_stdout = Popen(['ls', '-l'], stdout=PIPE).communicate()[0] communi () 메소드는 바이트 배열을 리턴합니다. >>> command_stdout b'total 0\n-rw-rw-r-- 1 thomas thomas 0 Mar 3 07:03 file1\n-rw-rw-r-- 1 thomas thomas 0 Mar 3 07:03 file2\n' 그러나 출력을 일반 Python 문자열로 …
2306
python
string
python-3.x