1. AJ R
  2. savReaderWriter

Source

savReaderWriter / savReaderWriter / doc_tests / test_SavReader_len.txt

##############################################################################
## Read a file and use len() to get number of records (__len__)
##############################################################################

>>> import sys
>>> sys.stdout.write('<skipline> '); from savReaderWriter import * # doctest: +ELLIPSIS
<skipline> ...

## ... get number of cases by using __len__
>>> savFileName = "../savReaderWriter/test_data/Employee data.sav"
>>> try:    # doctest: +ELLIPSIS
...     reader = SavReader(savFileName)        
...     print "The file contains %d records" % len(reader)
... finally:
...     reader.close()
The file contains 474 records