“Como obter a lista da string separada por vírgula em Python” Respostas de código

Como dividir uma entrada em Python por vírgula

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

Como separar uma string ou int com vírgula em python

 string = input('Input')
    >>> 1,2
    print(cord.split(','))
    >>>['1', '2']
Disturbed Donkey

Como obter a lista da string separada por vírgula em Python

##Write a Python program to input a string that is a list of words separated by commas. 
##Construct  a dictionary that contains all these words as keys and their frequencies as values.
##Then display  the words with their quantities.  

lst = []
d = dict()
user = input ("enter a string ::-- ")
lst = user.split(',')
print("LIST ELEMENR ARE :: ",lst)
l = len(lst)
for i in range(l) :
    c = 0
    for j in range(l) :
        if lst[i] == lst[j ]:
            c += 1
    d[lst[i]] = c
print("dictionary is  :: ",d)
Attractive Addax

Respostas semelhantes a “Como obter a lista da string separada por vírgula em Python”

Perguntas semelhantes a “Como obter a lista da string separada por vírgula em Python”

Mais respostas relacionadas para “Como obter a lista da string separada por vírgula em Python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código