On 2026-08-27 16:16:07 +0100, Rob Cliffe via Python-list wrote:
> I tried that; here is a hex dump of my concatenated file:
[...]
> but no dice; it printed the whole thing on one sheet, with the form feed
> printed as a
> thick-headed up-arrow character at the start of the second line.
> It's looking as if it will only switch sides when the first side is full.

You could just pad each files with newlines, like this:

#!/usr/bin/python3
import sys

lines_per_page = 72 # 12" fan-fold paper ;-)

for fn in sys.argv[1:]:
    line_no = 0
    with open(fn) as fh:
        for line in fh:
            print(line, end="")
            line_no += 1
    while line_no % lines_per_page != 0:
        print()
        line_no += 1

Of course this only works if the lines are short enough not to be
wrapped. Otherwise you'd have to implement line-wrapping, too.

I tend to agree with Mats: In this day and age converting to PDF and
printing that is probably best.

        hjp


-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email protected]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to