.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python\demoStringInput.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_demoStringInput.py: String input ============== This demo shows how to get input from the user. For more sophisticated inputs based on input boxes etc. please see the methods in the module ``itom.ui``. Inputs in this demo will force an input line in the command line (green background). Put some text there and press return to continue. .. GENERATED FROM PYTHON SOURCE LINES 10-20 .. code-block:: Python name = input("Please put your name after the colon:") age = input("Please put your age:") try: age_ = int(age) print("Hello %s. Your age is %i" % (name, age_)) except Exception: print("Your age could not be interpreted as integer") .. _sphx_glr_download_11_demos_python_demoStringInput.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demoStringInput.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demoStringInput.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demoStringInput.zip `