On 29 июл, 12:08, Roald de Vries wrote:
> First: list is a very unlucky name for a parameter, since it's the
> type of []
>
> Second: list comprehension rules!
>
> def groupListByRow(list):
> return [lst[start:start+5] for start in range(0, len(lst), 5)]
>
> Cheers, Roald
Perfect
Hello.
I have a list that i want to present in a table.
Each row should have 5 items.
For now i create the function that returns me new grouped list, that i
use later in a template.
def groupListByRow(list):
cnt=0
rows=[]
while cnthttp://groups.google.com/group/django-users?
2 matches
Mail list logo