Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

extended slices [::2]

merged = re.split(r"([ ,]+)", an_input)
    # the [::2] is to get the even indexes, which are the words
    # the [1::2] is to get the odd indexes, which are the separators
    return [merged[::2], merged[1::2]]
 
PREVIOUS NEXT
Tagged: #extended #slices
ADD COMMENT
Topic
Name
1+6 =