To read user input you can try the cmd module for easily creating a mini-command line interpreter (with help texts and autocompletion) and raw_input (input for Python 3+) for reading a line of text from the user.

text = raw_input("prompt")  # Python 2
text = input("prompt")  # Python 3

Command line inputs are in sys.argv. Try this in your script:

import sys
print (sys.argv)

There are two modules for parsing command line options: optparse (deprecated since Python 2.7, use argparse instead) and getopt. If you just want to input files to your script, behold the power of fileinput.

The Python library reference is your friend.

Answer from Antti Rasinen on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › taking-input-from-console-in-python
Taking input from console in Python - GeeksforGeeks
January 12, 2026 - The Python Console accepts commands in Python that you write after the prompt. Accepting Input from Console User enters the values in the Console and that value is then used in the program as it was required.
🌐
University of Vermont
uvm.edu › ~cbcafier › cs1210 › book › 07_console_io › input.html
Input from the console – Clayton Cafiero
June 24, 2025 - In this case, the user has typed “Sir Robin of Camelot”. When the user hits the enter/return key, the input() function returns what the user typed (before hitting enter/return) as a string. In this example, the string returned by input() is assigned the name users_name. On the third line, we enter the expression users_name and Python obliges by printing the associated value: “Sir Robin of Camelot”.
🌐
Wiingy
wiingy.com › home › learn › python › input from console in python
Input from Console in Python - Wiingy
April 15, 2025 - There is a built-in function in Python called “input()” that lets users enter data from the console.The string parameter that is passed to the input() function is used to ask the user for input.
🌐
W3Schools
w3schools.com › python › python_user_input.asp
Python User Input
That means we are able to ask the user for input. The following example asks for your name, and when you enter a name, it gets printed on the screen: ... Python stops executing when it comes to the input() function, and continues when the user has given some input.
🌐
Real Python
realpython.com › python-input-output
Basic Input and Output in Python – Real Python
July 3, 2026 - For a program to be useful, it often needs to communicate with the outside world. In Python, the input() function allows you to capture user input from the keyboard, while you can use the print() function to display output to the console.
🌐
KoderHQ
koderhq.com › tutorial › python › console-io
Python Console Input & Output Tutorial | KoderHQ
In this tutorial we learn how to use Python's input() function to take values from the console, and the print() function to display data in the console.
🌐
Wikiversity
en.wikiversity.org › wiki › Python_Concepts › Console_Input
Python Concepts/Console Input - Wikiversity
Retrieved from "https://en.wikiversity.org/w/index.php?title=Python_Concepts/Console_Input&oldid=2210221" Category: Python · Search · Python Concepts/Console Input ·
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › taking-input-from-console-in-python
Python - User Input
Inside the input() function, you may give a prompt text, which will appear before the cursor when you run the code. #! /usr/bin/python3.11 name = input("Enter your name : ") city = input("Enter your city : ") print ("Hello My name is", name) print ("I am from ", city)
🌐
GeeksforGeeks
geeksforgeeks.org › python › input-and-output-in-python
Input and Output in Python - GeeksforGeeks
The print() function is used for output in various formats and the input() function enables interaction with users. Python's input() function is used to take user input.
Published: September 19, 2026
🌐
Python Examples
pythonexamples.org › python-read-string-from-console
How to Read String from Console as Input in Python?
To read a string from console entered by user as an input in your Python program, you can use input() built-in function.
🌐
HowToDoInJava
howtodoinjava.com › home › python built-in functions › python input() function: read and validate user input
Python input() - Read User Input from Console
July 24, 2020 - The Python input() function shows an optional prompt, waits for the user to type a line, and returns that line as a string without the trailing newline. Small console scripts use it whenever they need a value from the person at the keyboard.
🌐
CodeRivers
coderivers.org › blog › python-console-input
Python Console Input: A Comprehensive Guide - CodeRivers
February 22, 2026 - Console input in Python refers to the process of getting data from the user through the command line interface. Python provides built-in functions to read this input, which allows for dynamic interaction between the program and the user. The input can be in various forms, such as a single string, ...
🌐
egghead.io
egghead.io › lessons › python-read-input-in-python-from-the-console
Read Input in Python from the Console | egghead.io
Learn how to implement it and validate user input in this lesson. ... Man: In Python, we can receive input from the user using the Python input function. I'll create a variable called name, and then call the input function.
Published: October 1, 2017
🌐
GeeksforGeeks
geeksforgeeks.org › python › taking-input-in-python
Taking Input in Python - GeeksforGeeks
Whether you type letters, numbers, or symbols, Python always stores it as a string by default. If you need another data type (like integer or float), you must convert it manually using typecasting. Example: This program checks the data type of user input to confirm that both number and name are stored as strings. ... num = input("Enter number:") print(num) name1 = input("Enter name: ") print(name1) # Printing type of input value print("Type of number:", type(num)) print("Type of name:", type(name1))
Published: May 29, 2026
🌐
PYnative
pynative.com › home › python › python input: take input from user
Python Input(): Take Input From User [Guide]
February 23, 2024 - In Python 3, we have the following two built-in functions to handle input from a user and system. ... The input() function reads a line entered on a console or screen by an input device such as a keyboard, converts it into a string.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-receive-user-input-python
How to Receive User Input in Python: A Beginner’s Guide | DigitalOcean
February 14, 2025 - Learn how to receive user input in Python using the input() function, command-line arguments, and GUI methods. Explore examples, best practices, and common m…
🌐
Recenturesoft
recenturesoft.com › taking-input-from-console-in-python
Taking input from console in Python | Recenturesoft
The easiest way to take input from the console in Python is to use the input() function.
🌐
AskPython
askpython.com › python › examples › python-user-input
Python User Input from Keyboard - input() function - AskPython
July 8, 2019 - Python’s input() function lets your program pause and wait for the user to type something on their keyboard. When the user presses Enter, whatever they typed gets returned as a string value your code can work with.