hello, i would like to have something like : if output_is_file: fh = file(filename, 'w') write = fh.write else: write = print ... for i in something write(i) how could i do that ? is this possible ? (i can't do "write = print" and don't understant why) thanks in advance, lt.