I want to use input() in Python code which runs in the Wolfram Notebook.
So I create an external evaluation cell by typing ">" and choosing Python. Then I define this function:
def func():
x = input()
print(x)
Then I try to call it:
func()
which makes Mathematica run forever and not evaluate.
Can I call Python's input() from within the notebook?
2020-09-04 updt. "input() reads from standard input. There is no standard input when using a notebook."
yes, but Jupyter does support it though
input()reads from standard input. There is no standard input when using a notebook. Maybe what you actually want is to read user input when running Python from Mathematica. But that is not what you asked. You asked specifically to useinput(). – Szabolcs Aug 28 '20 at 10:45Input(or some other, better way). – Szabolcs Aug 28 '20 at 14:02