Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to take unknown number of inputs in python

# PRESS ENTER WITHOUT WRITING TO STOP

inputs = []
while True:
    inp = input("Insert input: ")
    if inp == "":
        break
    inputs.append(inp)

print (inputs)
Comment

how to take unknown number of inputs in python

from sys import stdin 
lines = stdin.read().splitlines()
print(lines)
Comment

PREVIOUS NEXT
Code Example
Python :: display youtube video in jupyter notebook 
Python :: plot histogram python 
Python :: os.listdir in python 
Python :: map object to array python 
Python :: convert a data frame column values to list 
Python :: sqlite3 python parameterized query 
Python :: python list abstraction 
Python :: df empty 
Python :: pyqt5 qlineedit on change 
Python :: bar labeling in matplotlib 
Python :: phone number regex python 
Python :: post request in python flaks 
Python :: pip install django rest framework 
Python :: how to check nth prime in python 
Python :: uniform distribution python example 
Python :: how to check django rest framework version 
Python :: lecture de fichier python 
Python :: falsy values in python 
Python :: random.shuffle 
Python :: how to underline text in tkinter 
Python :: how to get only certain columns in pandas 
Python :: how to convert a byte array to string in python 
Python :: python list .remove() in for loop breaks 
Python :: pathlib path exists 
Python :: joblib 
Python :: python csv to list 
Python :: python iterate through dictionary 
Python :: pass variable in subprocess run python 
Python :: sum of all multiples of 3 and 5 below 100 
Python :: addition in python 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =