0

I am trying to create a utility program, but after the user types in the passcode and goes to the main menu, the passcode is still there and is show right above it. I asked this question before, but users gave me a command instead of something the script does for you. I was wondering if there is something I can type into my script that can clear the python shell without having to directly type it into the shell.

2
  • why do you show the passcode? even if you clear the screen it will be visible while typed... Commented May 4, 2013 at 16:34
  • if people gave you a command, can't you use that command with os.system to clear it? Commented May 4, 2013 at 18:20

2 Answers 2

4

You should use getpass to read passwords without echoing them, that's the reccomended way of reading passwords safely.

Sign up to request clarification or add additional context in comments.

Comments

1

If you are using Linux:

import os
os.system("clear")

if you are using windows:

import os
os.system('CLS')

Note: you should really not do something like this with passcodes for security reasons, but this does clear the shell

2 Comments

When I use it, it only restarts it.It doesn't erase it for me.
What system do you use? I just updated because I only included the Linux/mac terminal approach, if you are using windows try that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.