Hello,
Being interested in python as a replacement environment for my existing
codebase of Bash scripts, I stumbled across the following 'bug or feature':
Reading data from a pipe in python2.6.4 yields exactly what I expect,
while using python3.1.2, the output is enclosed with some b' and '.
I have been testing the following script:
-------------
import subprocess, sys
ls = subprocess.Popen(['ls', '-l', '/etc/motd'], stdout=subprocess.PIPE,)
end_of_pipe = ls.stdout
print('Result:')
for line in end_of_pipe:
print(line.strip())
-------------
Result from invoking with python2 and python3 are respectively:
Result:
-rw-rw---- 1 root root 25 Jan 18 10:25 /etc/motd
and:
Result:
b'-rw-rw---- 1 root root 25 Jan 18 10:25 /etc/motd'
Who is able to explain this to me ?
Thanks in advance. R.
_______________________________________________
Python-nl mailing list
Python-nl@python.org
http://mail.python.org/mailman/listinfo/python-nl