Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8843585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:15:48+00:00 2026-06-14T11:15:48+00:00

Suppose I have these two lists: column1 = [Attribute:,Virtual machine:,Troll:] column2 = [A value

  • 0

Suppose I have these two lists:

column1 = ["Attribute:","Virtual machine:","Troll:"]
column2 = ["A value associated with an object which is referenced by name using dotted expressions. For example, if an object o has an attribute a it would be referenced as o.a.", 
           "A computer defined entirely in software. Python's virtual machine executes the bytecode emitted by the bytecode compiler.",
           "Someone who posts inflammatory, extraneous, or off-topic messages in an online community, such as a forum, chat room, or blog, with the primary intent of provoking readers into an emotional response or of otherwise disrupting normal on-topic discussion."]

This code:

for c1, c2 in zip(column1, column2):
    print "%-16s %s" % (c1, c2)

Ouputs this text:

Attribute:       A value associated with an object which is referenced by name u
sing dotted expressions. For example, if an object o has an attribute a it would
be referenced as o.a.
Virtual machine: A computer defined entirely in software. Python's virtual machi
ne executes the bytecode emitted by the bytecode compiler.
Troll:           Someone who posts inflammatory, extraneous, or off-topic messag
es in an online community, such as a forum, chat room, or blog, with the primary
 intent of provoking readers into an emotional response or of otherwise disrupti
ng normal on-topic discussion.

While I would like this:

Attribute:       A value associated with an object which is referenced by name 
                 using dotted expressions. For example, if an object o has an 
                 attribute a it would be referenced as o.a.
Virtual machine: A computer defined entirely in software. Python's virtual 
                 machine executes the bytecode emitted by the bytecode compiler.
Troll:           Someone who posts inflammatory, extraneous, or off-topic 
                 messages in an online community, such as a forum, chat room, or 
                 blog, with the primary intent of provoking readers into an 
                 emotional response or of otherwise disrupting normal on-topic
                 discussion.

How do I get this result for any terminal size? (Someone advised me that Clint might be able to achieve this quite easily, has anyone done this yet?)

Note: The requirement that a word is not chopped in pieces by the end of a line is only secondary for me. The most important requirement is letting each string element of the column2 list continue with the same horizontal spacing as where the string of each element in that list started.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:15:50+00:00Added an answer on June 14, 2026 at 11:15 am
    from clint.textui import puts, columns
    
    width = 20
    
    for term, definition in zip(column1, column2):
        puts(columns([term, width], [definition, None]))
    

    …prefix with this to choose column width based on content:

    #derive 1st column width from longest term
    width = 0
    for s in column1:
        if len(s) > width :
            width = len(s) + 1
    

    Adapted from clint\examples\text_width.py. Thanks for the question; I didn’t know how to do this before, and it’s something I’ll use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have these two lists: column1 = [soft,pregnant,tall] column2 = [skin,woman, man] How
Suppose I have a simple to-do list application. The application contains two models: lists
I have these two lists: '(and 1 (or a b)) '( (a 0)(b 1)
Suppose I have two lists of numbers in files f1, f2, each number one
Suppose we have an object that can be sorted using two or more comparison
Suppose I have two comboboxes. One for the lower-value and one for the upper
Which one of these is faster? Is one better? Basically I'll have two sets
Suppose I have two lists L1 = [1,2,3] and L2 = [a,b,c] Whats the
Suppose there are two singly linked lists both of which intersect at some point
Suppose I have two lists, and corresponding elements of the lists are the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.