Can I create one or more fields to index on in the dbf module..
empInfo_table = dbf.Table('C:\Sonichr\\empInfo.DBF')
empInfo_table.open()
empInfo_index = empInfo_table.create_index(key = lambda rec: rec.storeid, rec.ssn - I get a syntax error)
print(empInfo_index)
for empInfo_rec in empInfo_table:
ssn = empInfo_rec.ssn
storeid = empInfo_rec.storeid
The problem you are having is one of Python syntax.
lambda arg1, arg2: some_expression, # lambda ends at first comma after the colon
To protect the comma and make it part of what lambda
returns, you parentheses:
lambda rec: (rec.storeid, rec.ssn)