The code checks if the file exists I am struggling to complete this and save my database (gen0values) and make it open to a file in a table.

def exportdata():

    print("\nYou chose option 4")
    import os
    filename = input("Please type in the filename")
    if os.path.isfile(filename):
        print("File exists")
    else:
        print("File does not exist")

What kind of data does the database contain ? Do you know how you want the data to appear in the file ?

In a 2D Table Array

Depending on your data, there are several ways to do this. A simple one is to write a csv file using the csv module. See https://pymotw.com/3/csv/ for explanations. A csv file can be opened with any office suite such as LibreOffice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.