19
Конвертировать байты в строку
Я использую этот код для получения стандартного вывода из внешней программы: >>> from subprocess import * >>> command_stdout = Popen(['ls', '-l'], stdout=PIPE).communicate()[0] Метод communication () возвращает массив байтов: >>> 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' Тем не …
2311
python
string
python-3.x