[Tutor] Print a list in columnar format

Jacob S. keridee at jayco.net
Thu Oct 7 00:40:09 CEST 2004


Ah hah!

    I can answer the last question. I tried to make the first question
become answered, but I failed greatly. Why do things not seem to work for
me?

Anyway, for question 2:


    numoflines = 20  # This is the number of lines that you can display per
page
    a = ['20301','Birds of a feather','20111','Flock together']
    t = 0
    for x in a:
        if t <= numoflines:   # This says to check if you've extended past
num of lines per page
            print x
            t = t + 1  # This increments t so you can be sure how many lines
you've printed on
        else:
            raw_input('Press enter to continue. ')  # This pauses until user
presses enter
            print x
            t = 0    # When user presses enter, this sets the line count
back to zero for another 20

----------------------------------------------------------------------------
--------------

Hope this really does help. I am a newbie to the mailing list, and
apparently not as experienced as I thought I was at Python scripting.

Jacob Schmidt




More information about the Tutor mailing list