List Info

Thread: Genshi Iteration Newbie Question




Genshi Iteration Newbie Question
user name
2007-12-23 21:01:51
Hi,

Sorry for this very newbie question: how to iterate N times
over an
integer variable = N in Genshi?

Many thanks in advance!

Regards,
Jerry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshigooglegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Genshi Iteration Newbie Question
country flaguser name
Netherlands
2007-12-24 00:47:42
-On [20071224 04:12], jerryji (jerryji1976gmail.com) wrote:
>Sorry for this very newbie question: how to iterate N
times over an
>integer variable = N in Genshi?

I think you need something like:

<py:for each="num in range(var)">
  <p>$num</p>
</py:for>

Where var is your integer variable.

-- 
Jeroen Ruigrok van der Werven
<asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル
ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
In every stone sleeps a crystal...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshigooglegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Genshi Iteration Newbie Question
user name
2007-12-29 15:07:06
On Dec 23, 10:47 pm, Jeroen Ruigrok van der Werven
<asmo...in-
nomine.org> wrote:
> -On [20071224 04:12], jerryji (jerryji1...gmail.com) wrote:
>
> >Sorry for this very newbie question: how to iterate
N times over an
> >integer variable = N in Genshi?
>
> I think you need something like:
>
> <py:for each="num in range(var)">
>   <p>$num</p>
> </py:for>
>
> Where var is your integer variable.

Or if "var" is potentially large you can use
xrange(var) instead which
just creates an iterable object while range(var) builds a
list of that
length.

-- Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshigooglegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )