Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subdividing a column
#9
Writing to file in 'table-style' (4 space columns, right-justified) can be done with something like this:

with open('output.txt', 'w') as f:
    for row in zip_longest(*columns, fillvalue=""):
        print(*(item.rjust(4, ' ') for item in row), file=f)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Subdividing a column - by mesh01 - Jun-27-2021, 04:18 PM
RE: Subdividing a column - by Larz60+ - Jun-28-2021, 02:25 AM
RE: Subdividing a column - by mesh01 - Jun-28-2021, 10:00 PM
RE: Subdividing a column - by bowlofred - Jun-28-2021, 11:05 PM
RE: Subdividing a column - by mesh01 - Jun-29-2021, 01:35 PM
RE: Subdividing a column - by mesh01 - Jul-02-2021, 01:06 PM
RE: Subdividing a column - by deanhystad - Jul-02-2021, 04:52 PM
RE: Subdividing a column - by bowlofred - Jul-02-2021, 09:20 PM
RE: Subdividing a column - by perfringo - Jul-04-2021, 06:59 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020