How to replace stdout\ nin subproccess with <br>

I want to replace n in subproccess"s stout with
. I tried the following, but it didn"t work, using python3

a=subproccess.Popen("ls -al",stdout=subproccess.PIPE,shell=Ture)

I used the following code first, but there was an error "str"does not support the buffer interface

.
b=a.stdout.read().replace("\n","<br>") 

then I tried the following command again, and there was no error, but the replacement was not successful

b=str(a.stdout.read()).replace("\n","<br>") 
Mar.29,2021

your code is wrong from beginning to end. Can you organize the code when you ask questions? The version of python used is also not specified

I assume you are using python2, and you want to read standard output from subprocess. The correct way to write it is:

a = subprocess.Popen('ls -l', shell=True, stdout=subprocess.PIPE)
b = a.stdout.read().replace('\n', '<br>')

if python3,a.stdout.read () gets bytes, so you can:

b = a.stdout.read().decode().replace('\n', '<br>')
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e446dd-43064.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e446dd-43064.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?