If you want to save what you print, you could create a custom command, and save the output to a variable. For example
output_bin = ""
def printsave(string):
print string
if len(string) > 1:
if string[-2] == "\n":
output_bin = output_bin + string
else:
output_bin = output_bin + string + "\n"
else:
output_bin = output_bin + string + "\n
Then, whenever you call printsave()
it is saved to the string output_bin
. And if you want it to be saved to an array...
output_bin = []
def printsave(string):
print string
if len(string) > 1:
if string[-2] == "\n":
output_bin.append(string)
else:
output_bin.append(string + "\n")
else:
output_bin.append(string + "\n)