OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. | 2 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr | 3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
4 # | 4 # |
5 # This file is part of logilab-common. | 5 # This file is part of logilab-common. |
6 # | 6 # |
7 # logilab-common is free software: you can redistribute it and/or modify it unde
r | 7 # logilab-common is free software: you can redistribute it and/or modify it unde
r |
8 # the terms of the GNU Lesser General Public License as published by the Free | 8 # the terms of the GNU Lesser General Public License as published by the Free |
9 # Software Foundation, either version 2.1 of the License, or (at your option) an
y | 9 # Software Foundation, either version 2.1 of the License, or (at your option) an
y |
10 # later version. | 10 # later version. |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 http://www.physics.ox.ac.uk/users/santoso/Software.Repository.html | 30 http://www.physics.ox.ac.uk/users/santoso/Software.Repository.html |
31 page says code is "available as is without any warranty or support". | 31 page says code is "available as is without any warranty or support". |
32 """ | 32 """ |
33 | 33 |
34 import struct | 34 import struct |
35 import os, os.path | 35 import os, os.path |
36 import sys | 36 import sys |
37 import csv | 37 import csv |
38 import tempfile | 38 import tempfile |
39 import ConfigParser | 39 |
| 40 from six.moves import range |
40 | 41 |
41 class Dbase: | 42 class Dbase: |
42 def __init__(self): | 43 def __init__(self): |
43 self.fdb = None | 44 self.fdb = None |
44 self.fmemo = None | 45 self.fmemo = None |
45 self.db_data = None | 46 self.db_data = None |
46 self.memo_data = None | 47 self.memo_data = None |
47 self.fields = None | 48 self.fields = None |
48 self.num_records = 0 | 49 self.num_records = 0 |
49 self.header = None | 50 self.header = None |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 for i in range(0, num): | 221 for i in range(0, num): |
221 record = db.get_record_with_names(i) | 222 record = db.get_record_with_names(i) |
222 rec.append(record) | 223 rec.append(record) |
223 db.close() | 224 db.close() |
224 return rec | 225 return rec |
225 | 226 |
226 if __name__=='__main__': | 227 if __name__=='__main__': |
227 rec = readDbf('dbf/sptable.dbf') | 228 rec = readDbf('dbf/sptable.dbf') |
228 for line in rec: | 229 for line in rec: |
229 print '%s %s' % (line['GENUS'].strip(), line['SPECIES'].strip()) | 230 print '%s %s' % (line['GENUS'].strip(), line['SPECIES'].strip()) |
OLD | NEW |