The problem I am having is with leading whitespace is being striped during append. The other issue is the database is not being reindexed. I am not using the last column of the csv file. The second column has two leading spaces. The issue is I need the space entered or the module that uses this database doesn't read the ratestep column correctly. The database is indexed on the first column (npanxx) assending.
csv data:
629200, 1,TRUE
629201, 1,TRUE
629205, 1,TRUE
629207, 1,TRUE
629209, 1,TRUE
629210, 1,TRUE
629214, 1,TRUE
629218, 1,TRUE
629219, 1,TRUE
629220, 1,TRUE
629222, 1,TRUE
629223, 1,TRUE
629233, 1,TRUE
629335, 1,TRUE
629444, 1,TRUE
629772, 1,TRUE
f = open("areacodes.csv","r")
r = csv.reader(f)
db = dbf.Table('NPA0001.DBF')
db.open(mode=dbf.READ_WRITE)
# print(db('npanxx'))
# db.zap()
db.close()
for row in r:
NPANXX_id = row[0]
RATESTEP_id = str(row[1])
RATESTEP_length = len(str(row[1]))+2
RATESTEP_revised = RATESTEP_id.rjust(RATESTEP_length)
AOS_id = 1
db.open(mode=dbf.READ_WRITE)
db.append(NPANXX_id,RATESTEP_id,AOS_id))
db.open(mode=dbf.READ_WRITE)
db.reindex()
db.close()
f.close()
dBase III database table:

You can see the string data for column 2 has spaces on data it to the right of the column.

Thanks,
Paul