SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    clearing python Shell

    I am new to python... can anyone help me to use function how to clear python Shell... like using function system("cls") or clrscr()....

  2. #2
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    65 Post(s)
    Tagged
    2 Thread(s)

  3. #3
    Team SitePoint
    Join Date
    Aug 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    I'm on a GNU/Linux system.

    Code:
    import os
    os.system('clear')
    is one way to do it here, but let's face it - that's *way* too much typing just to clear the screen on occasion, so I just press Ctrl+L.

    This works fine when running python interactively, using ipython, and in many other applications that can be run from within a *NIX terminal emulator. It probably won't work with IDLE, since that's a Tk app.

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Hell I just use it for quickie testing of something, so I ctrl-d and then usually close that terminal window :P

  5. #5
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,182
    Mentioned
    65 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by boltronics View Post
    but let's face it - that's *way* too much typing just to clear the screen on occasion, so I just press Ctrl+L.
    That is a bit much typing for my taste

  6. #6
    SitePoint Member
    Join Date
    Jun 2014
    Location
    chicago
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are using python IDE in the windows os.system('CLS') this code might help you to achieve the task.
    AS the linux is concerned the import os os.system('clear') can be used.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •