[Zope] How to know if a list contains a specified item ?

andres@corrada.com andres@corrada.com
Wed, 7 Jun 2000 13:41:27 -0400


On Wed, Jun 07, 2000 at 06:14:22PM +0200, QUIN Frédéric wrote:
> 
> I would like to know if there is a function which allows to know if a list
> contains a specified item.
> 

Fred,
You can use Python's "x in list" syntax as follows

<dtml-let list="[1, 'a']">
  <dtml-if "1 in list">
    ...
  </dtml-if>
  .
  .
  <dtml-if "'a' in list">
    ...
  </dtml-if>
</dtml-let>

------------------------------------------------------
Andres Corrada-Emmanuel   Email: andres@corrada.com
------------------------------------------------------