1

When I use input() in Jupyter notebook and after I put something in the input box, there is a print-out of what I inputted between the In and Out lines (5 in the middle in the example). Is there a way that input() wouldn't print that out?

enter image description here

John M.
  • 825
  • 1
  • 10
  • 22
  • Does [this SO question](https://stackoverflow.com/questions/4616813/can-i-get-console-input-without-echo-in-python) answer your question? From what I understand the problem is that input will echo whatever you type. I don't know how this will work on a notebok though. – UziGoozie May 29 '21 at 16:44
  • @Carcigenicate this is for demo only. when I do `x=input()`, there is still a print-out and I am trying to find a way to surpress that. – John M. May 29 '21 at 16:53
  • @Carcigenicate Thanks. However, these are actually suppressing the output line instead of the middle print. Am I having a wrong setting if you could reproduce on your end? – John M. May 29 '21 at 17:17
  • @JohnM. My apologies. I misinterpreted what you were asking. – Carcigenicate May 29 '21 at 17:19
  • I suspect that display is produced by the system `readline` that echos your `stdin` to `stdout`. The `input` docs says the `prompt`, if any, is written to `stdout`. You might be able to get around this by temporarily redirecting `sys.stdout`. – hpaulj May 30 '21 at 01:52

0 Answers0