On Jun 27, 7:40 pm, XiaQ <hn_sd_ywx_x... at 163.com> wrote: > I need to build a stream that writes to stdout and a file at the same > time. Is there already a function in the Python library to do this? class FileAndStdout(file): def write(self, data): file.write(self, data) sys.stdout.write(data)