Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialayub ali
Courses Plus Student 723 Pointshelp with this guys
when i try to delete my text program in the console, using python, i cant like the other programming language, command line, clear:and it clears out, but tell me what is the keyword for python to delete something in the console
4 Answers
K Cleveland
21,839 PointsYou sure? Did you type into the console:
import os
Then hit enter. Then, type in:
os.system("clear")
Thanks!
Jennifer Nordell
Treehouse TeacherHi there! My advice would be to try CTRL + L or CMD + L. See if that does what you're hoping!
K Cleveland
21,839 PointsI tried CTRL + L and that works as well.
ayub ali
Courses Plus Student 723 Pointsi dont have cmd on my keyboard
Jennifer Nordell
Treehouse TeacherThen use CTRL
ayub ali
Courses Plus Student 723 Pointsthank you jennifer, no wonder you have alot of points
K Cleveland
21,839 Pointsimport os
os.system("clear")
I'd also recommend getting used to searching out answers online, as you'll see so many people will have the same issues! That way, you can solve your own issues before posting. Good luck!
ayub ali
Courses Plus Student 723 Pointsbut i am doing that is not working the word clear
ayub ali
Courses Plus Student 723 Pointsyeah it worked but, there is one proplem, when i cleaned my console. and I start rewrite my console, writing it says the python is not defined any solution please
Jennifer Nordell
Treehouse TeacherIf your prompt begins with >>>
it means you're still in the python shell and do not need to type python
again to start it. If you want to exit the Python shell type exit()
. Otherwise, you can simply keep coding where you left off.
ayub ali
Courses Plus Student 723 Pointsyes it cleared out, but, when i write python again it says;python is not defined something like that
Jennifer Nordell
Treehouse TeacherTo reiterate:
If your prompt begins with >>> it means you're still in the python shell and do not need to type python again to start it. If you want to exit the Python shell type exit(). Otherwise, you can simply keep coding where you left off.
K Cleveland
21,839 PointsYou're getting this error, correct?
NameError: name 'python' is not defined
You don't need to write python again because you're already in the python shell. Have you taken the Python Basics course here? I think that would be incredibly helpful, too!
ayub ali
Courses Plus Student 723 Pointsayub ali
Courses Plus Student 723 Pointsi did that, i am using windows 10, cant somebody make it clear like one word.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse Teacherayub ali I am also using Windows 10. What I'm curious about now is your keyboard. To the left of the "Windows" key (the one with the Windows logo) you should have a button that says "Ctrl" or "CTRL". If you press that and hold it down and then press "L", it should clear the console both in and out of the Python shell.