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

Tate Price
PLUS
Tate Price
Courses Plus Student 9,921 Points

clear screen in python shell

the clear screen function will not work in the python shell. the screen just flashes and stays the same.

import os

os.system('cls')

1 Answer

Steven Parker
Steven Parker
229,644 Points

Perhaps you're not using a Windows system. Try this instead:

os.system("clear")
Tate Price
Tate Price
Courses Plus Student 9,921 Points

Yes, I'm using Windows. I tried the mac, and linux version anyway though, but it didn't work.

Steven Parker
Steven Parker
229,644 Points

In that case, you might want to take this up with the Support folks.

@ Steven Parker: You rock! thx

Steven Parker
Steven Parker
229,644 Points

Well, thanks! It's fun to know something I wrote over a year ago is still helping. :wink: