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 trial

Python Object-Oriented Python Instant Objects Let's Make a Class!

help 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
K Cleveland
21,839 Points

You sure? Did you type into the console:

import os

Then hit enter. Then, type in:

os.system("clear")

Thanks!

i did that, i am using windows 10, cant somebody make it clear like one word.

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

ayub 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.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! My advice would be to try CTRL + L or CMD + L. See if that does what you're hoping! :sparkles:

K Cleveland
K Cleveland
21,839 Points

I tried CTRL + L and that works as well.

i dont have cmd on my keyboard

thank you jennifer, no wonder you have alot of points

K Cleveland
K Cleveland
21,839 Points

import 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!

but i am doing that is not working the word clear

yeah 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
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

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.

yes it cleared out, but, when i write python again it says;python is not defined something like that

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

To 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
K Cleveland
21,839 Points

You'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!