It is quite common that you need to grab a logged in user name and ask for the password from a user on an application launch. The biggest question that comes here is — Can we grab password from user in plain text? Can password input be in plain text which can be seen while entering? Of course not. As a password is considered as one of the most sensitive data, it can not be exposed so lightly. Due to its sensitivity, either user input has to be masked or it had taken in invisible form. Let’s learn about it in more detail. Like every other Python application, here also we need to import the required module/package and that is getpass . Required Package getpass allows us to prompt for password without having the password displayed on screen or on user’s terminal. Below is the command to install getpass : pip install getpass Python Copy Read User Name getpass has a function named getuser() , which gives us the login name of a currently logged-in user. userName = getpass . getuser ( ) Pyth
This blog is all about my technical learnings pertaining to LLM, OpenAI, Azure OpenAI, C#, Azure, Python, AI, ML, Visual Studio Code and many more.