split list in 3 part
def even_divide(lst, num_piece=4):
return [
[lst[i] for i in range(len(lst)) if (i % num_piece) == r]
for r in range(num_piece)
]
split list in 3 part
def even_divide(lst, num_piece=4):
return [
[lst[i] for i in range(len(lst)) if (i % num_piece) == r]
for r in range(num_piece)
]
split list on every nth element python
def chunks(list_in, n):
# For item i in a range that is a length of l,
for i in range(0, len(list_in), n):
# Create an index range for l of n items:
yield list_in[i:i+n]
# then just do this to get your output
list(chunks(our_list, cut_every))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us