Please code review.

Peter Otten __peter__ at web.de
Tue Aug 2 09:59:32 EDT 2011


Karim wrote:

> values = ( (22.5,21.5,121.5),
> (5615.3,615.3,-615.3),
> (-2315.7,315.7,415.7) )
> 
> it = _xrange_cellnames(rows=len(value), cols=len(values[0]))
> 
> table.getCellByName(it.next()).setValue(22.5)
> table.getCellByName(it.next()).setValue(5615.3)
> table.getCellByName(it.next()).setValue(-2315.7)

Some googling suggests that there exists a getCellByPosition() method. With 
that the above would become (untested):

for x, column in enumerate(values):
    for y, value in enumerate(column):
        table.getCellByPosition(x, y).setValue(value)





More information about the Python-list mailing list