Skip to main content

A CLI-based personal library manager

Project description

def save_books_to_file(connection, file_path="library.txt"): try: cursor= connection.cursor() query= "SELECT * FROM Books" cursor.execute(query) results= cursor.fetchall() cursor.close()

    with open(file_path, "w") as file:
        for row in results:
            file.write(f"{row}\n")

    print(f"Books data saved to {file_path}")
except Error as e:
    print(f"Failed to save books to file: {e}")

Project details


Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page