File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1809,7 +1809,7 @@ def records(self, fields=None):
1809
1809
records .append (r )
1810
1810
return records
1811
1811
1812
- def iterRecords (self , fields = None ):
1812
+ def iterRecords (self , fields = None , my_range = None ):
1813
1813
"""Returns a generator of records in a dbf file.
1814
1814
Useful for large shapefiles or dbf files.
1815
1815
To only read some of the fields, specify the 'fields' arg as a
@@ -1820,7 +1820,9 @@ def iterRecords(self, fields=None):
1820
1820
f = self .__getFileObj (self .dbf )
1821
1821
f .seek (self .__dbfHdrLength )
1822
1822
fieldTuples , recLookup , recStruct = self .__recordFields (fields )
1823
- for i in xrange (self .numRecords ):
1823
+ if my_range is None :
1824
+ my_range = xrange (self .numRecords )
1825
+ for i in my_range :
1824
1826
r = self .__record (
1825
1827
oid = i , fieldTuples = fieldTuples , recLookup = recLookup , recStruct = recStruct
1826
1828
)
You can’t perform that action at this time.
0 commit comments