(.env) boris@boris-All-Series:~/VOTING/CHUNK$ cat sliceListing.py
def slicer(sequence, size):
return (sequence[j:j + size] for j in range(0, len(sequence), size))
text = "It seems to me this manual is quite useless"
for banch in slicer(text, 9):
print(repr(banch),)
print ('^'.join(slicer(text, 12)))
arg_list = ['linux','GNU','public','license','gcc','g++','python']
for banch in slicer(arg_list, 2):
print(banch)
(.env) boris@boris-All-Series:~/VOTING/CHUNK$ python3 sliceListing.py
'It seems '
'to me thi'
's manual '
'is quite '
'useless'
It seems to ^me this manu^al is quite ^useless
['linux', 'GNU']
['public', 'license']
['gcc', 'g++']
['python']
No comments:
Post a Comment