Print to end of line in a terminal

Discussion in 'Python' started by ndlarsen, Feb 27, 2008.

  1. ndlarsen

    ndlarsen Guest

    Hey.

    This might seem as a arbitrary question to some. Anyway, I'm wondering
    how I go about printing text to the end of a line in a terminal/console.
    I've been googling it for a few days without any success. Any
    suggestions will be greatly appreciated.

    Regards ndlarsen
    ndlarsen, Feb 27, 2008
    #1
    1. Advertising

  2. ndlarsen wrote:

    > This might seem as a arbitrary question to some. Anyway, I'm
    > wondering how I go about printing text to the end of a line in a
    > terminal/console. I've been googling it for a few days without any
    > success. Any suggestions will be greatly appreciated.


    Well, just print ${COLUMNS} characters. If you rephrased your
    problem with more detail one could give better suggestions.

    Regards,


    Björn

    --
    BOFH excuse #202:

    kernel panic: write-only-memory (/dev/wom0) capacity exceeded.
    Bjoern Schliessmann, Feb 27, 2008
    #2
    1. Advertising

  3. ndlarsen

    John J. Lee Guest

    ndlarsen <> writes:

    > Hey.
    >
    > This might seem as a arbitrary question to some. Anyway, I'm wondering
    > how I go about printing text to the end of a line in a
    > terminal/console. I've been googling it for a few days without any
    > success. Any suggestions will be greatly appreciated.
    >
    > Regards ndlarsen


    Assuming by "end of a line" you mean "right-hand edge of the window",
    there's an example here:

    http://codespeak.net/svn/user/jjlee/rudolf/trunk/colorwatch.py


    Another alternative would be to use curses.


    John
    John J. Lee, Feb 28, 2008
    #3
  4. ndlarsen

    ndlarsen Guest

    Hello again.

    I apologize for not replying earlier but I have been swamped in work
    lately. I appreciate your replies. Eventually I chose using curses for
    "right-hand edge of the window" as it seemed to be the most suitable
    solution.

    Thank you.

    ndlarsen
    ndlarsen, Mar 27, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sam
    Replies:
    5
    Views:
    332
    MrJean1
    Oct 10, 2006
  2. keto
    Replies:
    0
    Views:
    928
  3. gaurav kashyap
    Replies:
    3
    Views:
    6,642
    Paul Boddie
    Oct 31, 2008
  4. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    348
    David Cournapeau
    Dec 30, 2008
  5. Steve
    Replies:
    2
    Views:
    932
    edicionsdigitals.com edicions digitals xarxa socia
    Dec 7, 2010
Loading...

Share This Page