It presents a prompt to the user (the optional arg
of raw_input([arg])
), gets input from the user and returns the data input by the user in a string. See the docs for raw_input()
.
Example:
name = raw_input("What is your name? ") print "Hello, %s." % name
This differs from input()
in that the latter tries to interpret the input given by the user; it is usually best to avoid input()
and to stick with raw_input()
and custom parsing/conversion code.
Note: This is for Python 2.x
Related Posts:
- What is the difference between rw+ and r+
- write() versus writelines() and concatenated strings
- No module named MySQLdb
- No module named MySQLdb
- How do you use subprocess.check_output() in Python?
- How can I concatenate str and int objects?
- How do you use subprocess.check_output() in Python?
- Python – ‘ascii’ codec can’t decode byte
- How to return dictionary keys as a list in Python?
- UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 20: ordinal not in range(128)
- TypeError: super() takes at least 1 argument (0 given) error is specific to any python version?
- What exactly do “u” and “r” string flags do, and what are raw string literals?
- Determine if 2 lists have the same elements, regardless of order? [duplicate]
- Using print() (the function version) in Python2.x
- How to read a CSV file from a URL with Python?
- How to import a csv-file into a data array?
- What does the “yield” keyword do?
- Renaming column names in Pandas
- Does Python have a string ‘contains’ substring method?
- Is there a “not equal” operator in Python?
- IndexError: list index out of range and python
- Python: ‘ModuleNotFoundError’ when trying to import module from imported package
- Check if a given key already exists in a dictionary
- ValueError: setting an array element with a sequence
- ‘python’ is not recognized as an internal or external command [duplicate]
- Importing modules from parent folder
- Should I use np.absolute or np.abs?
- Writing a list to a file with Python
- Why am I getting “LinAlgError: Singular matrix” from grangercausalitytests?
- if else in a list comprehension
- How can I make a Python script standalone executable to run without ANY dependency? [duplicate]
- python exception message capturing
- What is the best project structure for a Python application?
- In Matplotlib, what does the argument mean in fig.add_subplot(111)?
- Convert a python dict to a string and back
- sys.argv[1] meaning in script
- TypeError: Object of type ‘bytes’ is not JSON serializable
- How to initialize a two-dimensional array in Python?
- How to unpack pkl file?
- What does numpy.gradient do?
- How to clear the interpreter console?
- Get unique values from a list in python
- ‘list’ object has no attribute ‘shape’
- What does the ‘b’ character do in front of a string literal?
- How to add multiple values per key in python dictionary
- Pythonic way to combine FOR loop and IF statement
- Python: OverflowError: math range error
- Best way to replace multiple characters in a string?
- Convert base-2 binary number string to int
- Most efficient way to reverse a numpy array
- Python return list from function
- Remove all special characters, punctuation and spaces from string
- How to delete last item in list?
- How to configure logging to syslog in Python?
- Converting binary to decimal integer output
- Don’t understand this SyntaxError: illegal target for annotation
- No module named setuptools
- Using Queue in python
- Whats the difference between ‘for x in list:’ and ‘for x in list[:]:’
- Python: cannot concatenate ‘str’ and ‘int’ objects error
- How to “test” NoneType in python?
- AttributeError:’bytes’ object has no attribute ‘encode’
- python mpl_toolkits installation issue
- What does bitwise_and operator exactly do in openCV?
- RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
- Using BeautifulSoup to search HTML for string
- TensorFlow: Blas GEMM launch failed
- Python Weather API
- How do I get time of a Python program’s execution?
- Pandas DataFrame: replace all values in a column, based on condition
- How to create a trie in Python
- How to convert string to datetime format in pandas python?
- How to start from second index for for-loop
- Python: How to check if keys exists and retrieve value from Dictionary in descending priority
- Python: Converting string into decimal number
- Segmentation fault: 11 in OS X
- Removing duplicates from a list of lists
- plotly: TypeError: cannot convert dictionary update sequence element #0 to a sequence
- What does this Django regular expression mean? `?P`
- Strange error about invalid syntax
- ‘virtualenv’ is not recognized as an internal or external command, operable program or batch file
- Python Coin Toss
- Is it better to use path() or url() in urls.py for django 2.0?
- gunicorn.errors.HaltServer:
django - What is a clean, Pythonic way to have multiple constructors in Python?
- Python Login Script; Usernames and Passwords in a separate file
- Ignore .pyc files in git repository
- MovieWriter ffmpeg unavailable; trying to use class ‘matplotlib.animation.PillowWriter’ instead
- How can I access global variable inside class in Python
- Sorting arrays in NumPy by column
- How to open html file?
- In Python, is there an elegant way to print a list in a custom format without explicit looping?
- “Python version 2.7 required, which was not found in the registry” error when attempting to install netCDF4 on Windows 8
- Does tkinter have a table widget?
- Python 2.7 mixing iteration and read methods would lose data
- Conditional indexing with Numpy ndarray
- python numpy machine epsilon
- Installing lxml module in python
- Extracting specific selected columns to new DataFrame as a copy
- How to print both strings in a dictionary in Python