“Konwertuj ciąg na listę w Python” Kod odpowiedzi

Konwertuj ciąg na list Python

# To split the string at every character use the list() function
word = 'abc'
L = list(word)
L
# Output:
# ['a', 'b', 'c']

# To split the string at a specific character use the split() function
word = 'a,b,c'
L = word.split(',')
L
# Output:
# ['a', 'b', 'c']
SkelliBoi

Konwertuj ciąg na listę w Python

def dpro(string):
    convertedlist = list(string.split(" "))
    return convertedlist
  
print(dpro("this will convert to List"))
Attractive Ape

Odpowiedzi podobne do “Konwertuj ciąg na listę w Python”

Pytania podobne do “Konwertuj ciąg na listę w Python”

Więcej pokrewnych odpowiedzi na “Konwertuj ciąg na listę w Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu