User Input

User Input#

  • Python 3.6 uses the input() method.

  • Python 2.7 uses the raw_input() method

Example:

1 #!/usr/bin/env python3
2
3 def main():
4     username = input("Enter username:")
5     print("Username is: " + username)
6
7
8 if __name__ == "__main__":
9     main()

Note

Python stops executing when it comes to the input() function, and continues when the user has given some input.