I have this code in python:
string_a = "abcdef"
list_a = []
list_a[:0] = string_a
and it outputs ["a","b","c","d","e","f"]
and although this is exactly what I want I don't understand how it worked. this [:0]
basically means that we start from the beginning of the list and stop at the beginning, we have an empty list. After that we assign the value of the string to the empty list and then I don't understand what happens anymore.
How did the string got split into a list of single characters?