i have a php file calls a script and prints the output like this


    $output=shell_exec('/usr/bin/python hello.py');
    echo $output;


it prints;


    b'total 16\ndrwx---r-x 2 oae users 4096 Jul 31 14:21 .\ndrwxr-x--x+ 9 oae root 4096 Jul 26 13:59 ..\n-rwx---r-x 1 oae users 90 Aug 3 11:22 hello.py\n-rwx---r-x 1 oae users 225 Aug 3 11:22 index.php\n'


but it should be like this;


    total 16K
    drwx---r-x  2 oae users 4.0K Jul 31 14:21 ./
    drwxr-x--x+ 9 oae root  4.0K Jul 26 13:59 ../
    -rwx---r-x  1 oae users   90 Aug  3 11:22 hello.py*
    -rwx---r-x  1 oae users  225 Aug  3 11:22 index.php*


\n characters shouldn't be shown.How can i solve this?
An alternative would be wrapping the string between <pre>...</pre> tags.
Print python script output correctly in PHP