DbfRead:从一个数据库获取记录值并在另一个数据库中使用?

2024-09-30 00:29:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个带有for循环(不是EOF循环)的Python程序。在for循环中,我将记录值分配给strSsn和strStoreid,但我希望在另一个数据库循环中使用它们。当我在我设置它们的循环之后使用它们时,我只找到我设置它们的循环中最后一条记录的值

with DBF(r'C:\Sonichr\\empInfo.DBF',lowernames=True,load =True,ignore_missing_memofile=True) as empInfo_table:                    
    for empInfo_rec in empInfo_table:
        #Append the records in a list
        strSsn = empInfo_rec['ssn']
        strStoreid = empInfo_rec['storeid']

s20data_table = DBF('C:\Sonichr\\s20data.DBF',lowernames=True,load =True,ignore_missing_memofile=True)                   
for s20data_rec in s20data_table:
    storeId = s20data_rec['storeid']
    ssn = s20data_rec['ssn']
    positionde = s20data_rec['positionde']
    payrate = s20data_rec['payrate']

    if storeId + ssn == strStoreId + strSsn:
        if  positionde == 'Carhop' :
            abraPayRate1 = payrate
        else:
            abraPayRate0 = payrate 


更新


Tags: intruefor记录tablessnrecdbf

热门问题