Comment nous pouvons utiliser iter_rows() en Python openpyxl paquet?

Je suis en utilisant openpyxl paquet dans Python(Canopy) à l'utilisation de fichiers excel. Nous avons ce tutoriel, dans ce lien : LIEN

you can also use the openpyxl.worksheet.Worksheet.iter_rows() method:

>>> tuple(ws.iter_rows('A1:C2'))
((<Cell Sheet1.A1>, <Cell Sheet1.B1>, <Cell Sheet1.C1>),
 (<Cell Sheet1.A2>, <Cell Sheet1.B2>, <Cell Sheet1.C2>))

>>> for row in ws.iter_rows('A1:C2'):
...        for cell in row:
...            print cell
<Cell Sheet1.A1>
<Cell Sheet1.B1>
<Cell Sheet1.C1>
<Cell Sheet1.A2>
<Cell Sheet1.B2>
<Cell Sheet1.C2>

Comment nous pouvons importer openpyxl.worksheet.Worksheet.iter_rows() méthode en python? J'ai utilisé ce code:

import openpyxl as op
ms = op.load_workbook('mtest.xlsx')

ws = ms.active

op.worksheet.Worksheet.iter_rows()

Ce code retourne:

type object 'Worksheet' has no attribute 'iter_rows' 

Quel est le problème?

InformationsquelleAutor user2991243 | 2015-04-22