“Cómo ingresar los valores ints de coma separados en Python en Python” Código de respuesta

Valores separados por comas de entrada de Python

lst = input().split(',')
Relieved Ray

Cómo dividir una entrada en Python por coma

lst = input().split(',')#can use any seperator value inside '' of split
print (lst)
#given input = hello,world
#output: ['hello', 'world']
#another example 
lst = input().split(' ; ')#can use any seperator value inside '' of split
print (lst)
#given input = hello ; world ; hi there
#output: ['hello', 'world', 'hi there']
Adhun Thalekkara

cadena para enumerar en la coma de Python

# input comma separated elements as string 
str = str (raw_input ("Enter comma separated integers: "))
print "Input string: ", str

# conver to the list
list = str.split (",")
print "list: ", list
Outrageous Oyster

Cómo ingresar los valores ints de coma separados en Python en Python

lst = list(map(int, input("Enter comma separated values: ").split(",")))
loobiish

Respuestas similares a “Cómo ingresar los valores ints de coma separados en Python en Python”

Preguntas similares a “Cómo ingresar los valores ints de coma separados en Python en Python”

Más respuestas relacionadas con “Cómo ingresar los valores ints de coma separados en Python en Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código