[5235] | 1 | JAMB registration numbers |
---|
| 2 | ************************* |
---|
| 3 | |
---|
| 4 | :nodoctest: |
---|
| 5 | |
---|
| 6 | JAMB data is stored in a JAMBDataTable. |
---|
| 7 | |
---|
| 8 | We can import JAMB registration data from a regular CSV file: |
---|
| 9 | |
---|
| 10 | >>> datafile = 'jambsample.csv' |
---|
| 11 | >>> open(datafile, 'wb').write( |
---|
| 12 | ... '''reg_no,fst_sit_fname,lastname,firstname,middlenames,sex,date_of_birth,jamb_state,jamb_lga,course1,screening_date,screening_venue,entry_session,screening_type |
---|
| 13 | ... 91100546DD,ISUOSUO MOSES ODOMERO,ISUOSUO,MOSES,ODOMERO,M,25/5/1982,DEL,ISO-S,BSCPOL,2009/09/25 09:00:00 GMT+1,REPRINT SLIP AS FROM WED 23/09/2009,9,pde |
---|
| 14 | ... 91111834CC,DURUIHEOMA AUGUSTINA ADANNA,DURUIHEOMA,AUGUSTINA,ADANNA,F,15/4/1986,IMO,MBAIT,BSCPOL,2009/09/25 09:00:00 GMT+1,REPRINT SLIP AS FROM WED 23/09/2009,9,pde |
---|
| 15 | ... 91109351AC,ARISERE EBIKEBUNA COMFORT,ARISERE,EBIKEBUNA,COMFORT,F,6/1/1984,EDO,OV-SW,BSCPOL,2009/09/25 09:00:00 GMT+1,REPRINT SLIP AS FROM WED 23/09/2009,9,pde |
---|
| 16 | ... ''') |
---|
| 17 | |
---|
| 18 | Now we create a JAMBDataTable and import the data: |
---|
| 19 | |
---|
| 20 | >>> from waeup.sirp.jambtables import JAMBDataTable |
---|
| 21 | >>> table = JAMBDataTable() |
---|
| 22 | >>> len(list(table)) |
---|
| 23 | 0 |
---|
| 24 | |
---|
| 25 | >>> table.importFromCSV(datafile) |
---|
| 26 | >>> len(list(table)) |
---|
| 27 | 3 |
---|
| 28 | |
---|
| 29 | We can get the entries from the table as an iterator: |
---|
| 30 | |
---|
| 31 | >>> for x in table: |
---|
| 32 | ... print x |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | We can delete the table: |
---|
| 36 | |
---|
| 37 | >>> del JAMBDataTable |
---|
| 38 | |
---|
| 39 | Clean up: |
---|
| 40 | |
---|
| 41 | >>> import os |
---|
| 42 | >>> os.unlink(datafile) |
---|