Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python String to array using list comprehension

# Split the string to array of characters using list Comprehension

text1= "ABCDEFGH"
output1= [x for x in text1]
print(output1)

text2="A P P L E"
output2=[x for x in text2]
print(list(text2))
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Python #String #array #list #comprehension
ADD COMMENT
Topic
Name
6+4 =