Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

split python strings into pairs & complete uneven pairs

>>> s = "abcde"
>>> k = 2
>>> [s[i:i+k].ljust(k, "_") for i in range(0, len(s), k)]
['ab', 'cd', 'e_']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #split #python #strings #pairs #complete #uneven #pairs
ADD COMMENT
Topic
Name
9+2 =