| | |
Clearing the screen of text
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I suggest
Or even better
Last one:
python Syntax (Toggle Plain Text)
>>> print("\n" * 40)
python Syntax (Toggle Plain Text)
>>> def clear(): ... print("\n"*40) >>> clear()
python Syntax (Toggle Plain Text)
>>> def clear(): ... import sys ... for i in range(40): ... print(sys.ps1)
Last edited by Gribouillis; Sep 6th, 2009 at 4:29 pm.
Clearing the display screen in console mode depends on the Operating System, that and the limited usefulness is why many multiplatform computer languages do not include it.
Here is a Python version using module os ...
Here is a Python version using module os ...
python Syntax (Toggle Plain Text)
import os # works on windows nt (also xp and vista) or linux os.system(['clear','cls'][os.name == 'nt'])
Last edited by vegaseat; Sep 6th, 2009 at 6:14 pm.
May 'the Google' be with you!
•
•
Join Date: Sep 2009
Posts: 16
Reputation:
Solved Threads: 0
0
#10 Oct 20th, 2009
python Syntax (Toggle Plain Text)
import os # works on windows nt (also xp and vista) or linux os.system(['<strong class="highlight">clear</strong>','cls'][os.name == 'nt'])
![]() |
Other Threads in the Python Forum
- Previous Thread: Problems writing code for my project
- Next Thread: Letter frequency function using lists
Views: 708 | Replies: 12
| Thread Tools | Search this Thread |
Tag cloud for Python
anti assignment avogadro beginner bluetooth code convert count csv decimals def dictionary dynamic dynamically enter examples excel file float format frange ftp function gnu gui heads homework import input jaunty java lapse leftmouse line lines linux list lists loop microcontroller module mouse multiple newb number numbers output parsing path pointer port prime program programming projects py2exe pygame pygtk pyopengl pyqt python random raw_input recursion recursive redirect scrolledtext slicenotation software sqlite ssh stderr string strings subprocess syntax table tennis terminal text thread threading time tkinter tlapse tooltip tuple tutorial twoup ubuntu unicode unix urllib urllib2 variable web-scrape windows word wx.wizard wxpython






