“Как получить список от запятой отдельной строки в Python” Ответ

Как разделить вклад в Python за запятой

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

Как разделить строку или int с запятой в Python

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

Как получить список от запятой отдельной строки в 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

Ответы похожие на “Как получить список от запятой отдельной строки в Python”

Вопросы похожие на “Как получить список от запятой отдельной строки в Python”

Больше похожих ответов на “Как получить список от запятой отдельной строки в Python” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования