This is my first question, any feedback would be amazing.
I am calling a C program from Python3 and the string captured by my variable prints out the newline characters instead of processing a newline character.
Want this: hello world
I get: b'hello\nworld'
I have this c program called find.c:
int main(int argc, char *argv[]){
printf("%s:\n%s\n\n",argv[1],argv[2]);
return 0;
}
Executed/Ran/Processed by Python3:
import sys
import subprocess
user = sys.argv[1]
item = sys.argv[2]
out = subprocess.check_output(["./find", user, item])
print(out)
Once again, the string "out" contains the "\n" instead of treating it like a new line.
I've tried adding: universal_newlines=True and end="" to check_out() with no luck.
I've tried using Popen() and call() and they both still keep the "\n".
As a last note: I am outputting this string to a textarea in html. And yes I know the b'' is not actually part of the string.
Cheers!