instancemethod
Nanjundi
nanjundi at gmail.com
Sun Jan 21 17:35:19 EST 2007
>
> if __name__ == '__main__':
> gert=Db('localhost','root','******','gert')
> gert.excecute('select * from person')
> for x in range(0,gert.rowcount):
> print gert.fetchone()
> gert.close()
>
> gert at gert:~$ python ./Desktop/svn/db/Py/db.py
> Traceback (most recent call last):
> File "./Desktop/svn/db/Py/db.py", line 35, in <module>
> for x in range(0,gert.rowcount):
> TypeError: range() integer end argument expected, got instancemethod.
> gert at gert:~$
>
> Can anybody explain what i must do in order to get integer instead of
> a instance ?
Gert,
> for x in range(0,gert.rowcount):
gert.rowcount is the method (and not a data attribute).
gert.rowcount() is the method call, which get the return value from
method.
So try this.
for x in range( 0,gert.rowcount() ):
-N
More information about the Python-list
mailing list