I think the thing you want to converse is your stringIO not your print. I think you do this using six.stringIO https://pythonhosted.org/six/
But I have only read the doc, not done this in practice. Laura -- https://mail.python.org/mailman/listinfo/python-list