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 Python Basics Types and Branching String Methods

'clear' command doesn't work in REPL?

Following along with the lesson in the Console box, which is getting crowded, tried to use 'clear' and got a NameError: name 'clear' is not defined Why is this? and is there another way to clear the REPL aside from closing and reopening?

4 Answers

You can do 'Control L' to clear REBL

robertdorgan
robertdorgan
5,944 Points

control D drops you out of the REPL, whereas control L with clean up your screen (your previous lines of code are still in your practice session, and you can retrieve them by pressing the up arrow)

Have you tried?

import os;os.system("clear")

press control D to exit the REPL and then type in clear