summaryrefslogtreecommitdiffhomepage
path: root/python.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2015-10-14 09:47:42 -0500
committerLevi Bostian <levi.bostian@gmail.com>2015-10-14 09:47:42 -0500
commita779d9cfb6c8d20b33917c6e3e755a499e4339e3 (patch)
tree503fef3fdeaaab742841a0f129c88224f4acd848 /python.html.markdown
parentb4535eaae356e7c0977c29bbb25464d9e5034e6f (diff)
parente1d2f8c718858323e1716cc0bde4c652e9b87ce6 (diff)
Merge pull request #1471 from ankitaggarwal011/python27-input-operations-add
[python/en] Added instructions on how to perform input operations
Diffstat (limited to 'python.html.markdown')
-rw-r--r--python.html.markdown6
1 files changed, 6 insertions, 0 deletions
diff --git a/python.html.markdown b/python.html.markdown
index 57a4d0d6..b939ebbe 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -150,6 +150,12 @@ bool("") # => False
# Python has a print statement
print "I'm Python. Nice to meet you!" # => I'm Python. Nice to meet you!
+# Simple way to get input data from console
+input_string_var = raw_input("Enter some data: ") # Returns the data as a string
+input_var = input("Enter some data: ") # Evaluates the data as python code
+# Warning: Caution is recommended for input() method usage
+# Note: In python 3, input() is deprecated and raw_input() is renamed to input()
+
# No need to declare variables before assigning to them.
some_var = 5 # Convention is to use lower_case_with_underscores
some_var # => 5