Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python split input to list

input_string = input('Enter elements of a list separated by space ')
print("
")
user_list = input_string.split()
# print list
print('list: ', user_list)

# convert each item to int type
for i in range(len(user_list)):
    # convert each item to int type
    user_list[i] = int(user_list[i])
Comment

PREVIOUS NEXT
Code Example
Python :: pairplot with selected field 
Python :: how to write variables in python 
Python :: python dictionary append value if key exists 
Python :: sqlalchemy_database_uri 
Python :: Read JSON files with automatic schema inference 
Python :: pip not downlaoding cryptography wheel macos 
Python :: ffill dataframe python 
Python :: django get fields data from object model 
Python :: rasperry pi camera 
Python :: read data from s3 bucket python 
Python :: change index to dataframe pandas 
Python :: pi in python 
Python :: Range python iterate by 2 
Python :: list of dict values 
Python :: python remove empty values from list 
Python :: input python 3 
Python :: all frequency offset in pandas 
Python :: insert row at given position in pandas dataframe 
Python :: python verify if string is a float 
Python :: create endpoint in python 
Python :: UnicodeDecodeError: ‘utf8’ codec can’t decode byte 
Python :: python .nlargest 
Python :: timer in python 
Python :: xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0 
Python :: get body from request python 
Python :: gráfico barras python 
Python :: logging 
Python :: blender python add collection to scean collection 
Python :: subtract list from list python 
Python :: pytest teardown method 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =