Merging multiple dbf files by file uploader

Hi,

I have a folder with a lot of dbf files (T01,T02… and M01,M02…).I would like that when all files are selected by st.file_uploader, 2 tables are created, the first is merged files starting with β€˜T’ the second is starting with β€˜M’ and these 2 tables are displayed.

I try something like this but its not working ;(

from simpledbf import Dbf5
import pandas as pd

uploaded_file = st.file_uploader("Choose a file", accept_multiple_files=True)
if uploaded_file is not None:
    for file in glob.glob("*.dbf"):
        listOfFiles.append(file)

    for file in listOfFiles:
        Dbf5(file)
        if file.startswith('T'):
            Table = Dbf5(file)
            DF1 = pd.DataFrame(Table)
            tempDF = tempDF.append(DF1, sort=False)
        elif file.startswith('M'):
            Table2 = Dbf5(file)
            DF2 = pd.DataFrame(Table2)
            tempDF2 = tempDF2.append(DF2, sort=False)
DFT = tempDF
DFM = tempDF2
st.write(DFT)
st.write(DFM)

Any solution ? This can be done using any lib.