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 Answers
You should use getpass to read passwords without echoing them, that's the reccomended way of reading passwords safely.
Comments
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
user2349129
When I use it, it only restarts it.It doesn't erase it for me.
Ryan Saxe
What system do you use? I just updated because I only included the Linux/mac terminal approach, if you are using windows try that
os.systemto clear it?