import sqlite3
# Connect to the database
connection = sqlite3.connect('your_database.db')
cursor = connection.cursor()
# Replace 'your_table' with the actual table name
table_name = 'your_table'
# Execute a query to retrieve the column names
cursor.execute(f"PRAGMA table_info({table_name})")
# Fetch all rows containing column information
columns = cursor.fetchall()
# Extract the column names (2nd item in each row)
column_names = [column[1] for column in columns]
# Print the column names
for column_name in column_names:
print(column_name)
# Close the database connection
connection.close()