12

I need something like raw_input, but without displaying the text you are typing. Also I tried getpass, but it still displays what I just typed.

Xantium
  • 11,201
  • 10
  • 62
  • 89
user2349129
  • 123
  • 1
  • 6

2 Answers2

11

getpass work very well either in command prompt or in python script.

import getpass
x = getpass.getpass("Input something: ")
print x
Yarkee
  • 9,086
  • 5
  • 28
  • 29
2

getpass() doesn't work in IDLE. Try it in command prompt or on the terminal.

Xantium
  • 11,201
  • 10
  • 62
  • 89
Sunjay Varma
  • 5,007
  • 6
  • 34
  • 51
  • I need something that can do it within the script. So if getpass doesn't work in the IDLE, then I need something else – user2349129 May 05 '13 at 03:04
  • 1
    Why exactly is this necessary to take an input in the script, but not display it? `getpass()` works very well in every application I can think of, so what exactly are you using this for? – Ryan Saxe May 05 '13 at 03:17