I have a variable which give as output numbers taken from a list every loop.
idx = 0
for i in y:
listbyte = subprocess.check_output('python foo.py ' + path + str(y[idx]), shell=True).rstrip()
idx += 1
listnum = listbyte.decode()
number = (listnum[0])
print(number)
u.append(listnum)
If I print number, the output format is:
1
2
3
4
5
If I put end = '' at the end of the print, it works pretty well, outputing: 12345.
The question is: how can I make this output a variable ? I have to use this format for some code ahead in the program but from what I see the end = '' argument is something restricted to print() function.
It should be something like this:
a = number(listnum[0])
print(a)
>>>12345
Thanks
EDIT: using Megabeets answer, the output now is:
0
09
091
0912
09126
091265
0912655
09126554
091265548
''.join().