“ciąg do listy 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

ciąg do listy Python

# Python code to convert string to list
  
def Convert(string):
    li = list(string.split(" "))
    return li
  
# Driver code    
str1 = "Geeks for Geeks"
print(Convert(str1))
AVIGNAN NAG

Odpowiedzi podobne do “ciąg do listy Python”

Pytania podobne do “ciąg do listy Python”

Więcej pokrewnych odpowiedzi na “ciąg do listy Python” w Python

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

Przeglądaj inne języki kodu