I have a function using popen() that returns stdout as an array.
using Python3 the arrays are returned correctly, but under python 2.7 each element is prefixed with a 'u'
def exe(cmd):
from subprocess import Popen, PIPE, STDOUT
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
arr = p.stdout.read().decode().split("\n")
print(arr)
del arr[-1]
if(arr[0]=='not found.'): arr = [];
return arr
[u'10-000801d5a12d', u'']
Where is this 'u' coming from and how do I prevent it ?