On 29 May 2010 23:24, Astley Le Jasper <[email protected]> wrote:
> def createlist():
> column_title_list = (
> ("id",20,"integer"),
> ("companyname",50,"text"),
> getproducts(),
> ("contact",50,"text"),
> ("email",50,"text"),
> )
> return column_title_list
>
Note that you're creating a Tuple, not a List. They're not the same thing.
Try this:
column_title_list = [
("id",20,"integer"),
("companyname",50,"text"),
("contact",50,"text"),
("email",50,"text"),
]
# Insert into the list with slicing syntax.
column_title_list[2:3} = getproduct()
This will not work with tuples, as they are immutable. Lists are.
Cheers,
Xav
--
http://mail.python.org/mailman/listinfo/python-list