I wanted to print the OS system information for a Pi in python. The OS command "cat /etc/os-release" works fine in the Terminal with nice row formatting.
In Python I used :
import subprocess
output = subprocess.check_output("cat /etc/os-release", shell=True)
print("Version info: ",output)
That works, but I do not get any newlines:
Version info: b'PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"\nNAME="Raspbian GNU/Linux"\nVERSION_ID="9"\nVERSION="9 (stretch)"\nID=raspbian\nID_LIKE=debian\nHOME_URL="http://www.raspbian.org/"\nSUPPORT_URL="http://www.raspbian.org/RaspbianForums"\nBUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"\n'
How can I format the output to add newlines?