Similarly to this question I would like to evaluate (in org mode) Python source code blocks containing "input" instructions but I can't find a way to have an interactive evaluation (with user input) during evaluation or to give it some input known in advance (stored in a file for instance).
My constraint is to use explicitly the input
instruction since all this should be included in a textbook for students.
Example of code :
#+BEGIN_SRC python :results output
a= input("Value")
print(a)
#+END_SRC
Is it possible to have such an interactive evaluation or to simulate it (by giving to the source code a fake input) ?
export
to generate your example code for the students into some other format, e.g. html? – Melioratus Sep 06 '16 at 05:10noweb
, of org-mode that will allow you to test & export your code with results. – Melioratus Sep 06 '16 at 18:14tangle
any files unless you want to provide students your code samples as standalone scripts. Also you can choose if you want to be prompted for input when exporting by using elisp to ask you. I find creating and maintaining code examples as literate programs is much easier in the long term. – Melioratus Sep 07 '16 at 14:43