Answers for "split python strings into pairs & complete uneven pairs"

0

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_']
Posted by: Guest on June-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language