“Comment obtenir la liste de la chaîne séparée par des virgules en python” Réponses codées

Comment diviser une entrée dans Python par virgule

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

Comment séparer une chaîne ou un int avec une virgule dans Python

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

Comment obtenir la liste de la chaîne séparée par des virgules en 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

Réponses similaires à “Comment obtenir la liste de la chaîne séparée par des virgules en python”

Questions similaires à “Comment obtenir la liste de la chaîne séparée par des virgules en python”

Plus de réponses similaires à “Comment obtenir la liste de la chaîne séparée par des virgules en python” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code