[Zope] concatenating lists via dtml

Hannu Krosing hannu@tm.ee
Wed, 08 Mar 2000 11:56:08 +0200


Ingo Assenmacher wrote:
> 
> Hello!
> 
> How do you concatenate lists (or add a new listelement) to
> list-properties?

<dtml-call "mylist.append(element)">

<dtml-call "mylist.extend(another_list)">

in general, fire up python interpreter and explore :

[hannu@hu hannu]$ python
Python 1.5.2 (#1, Apr 18 1999, 16:03:16)  [GCC pgcc-2.91.60 19981201
(egcs-1.1.1  on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> dir([])
['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse',
'sort']
>>> l = [9]
>>> l.extend([1,2,3])
>>> l
[9, 1, 2, 3]
>>> l.append([1,2,3])
>>> l
[9, 1, 2, 3, [1, 2, 3]]
>>> 


-------------
Hannu