import sqlite3

list_Names = ('information.docx', 'Hello.txt', 'myImage.png', \
                        'myMovie.mpg', 'World.txt', 'data.pdf', 'myPhoto.jpg')

#create a data structure
conn = sqlite3.connect('Asgn_162.db')
c = conn.cursor()

#Create table
c.execute("CREATE TABLE IF NOT EXISTS namesTable( \
            ID INTEGER PRIMARY KEY AUTOINCREMENT,  \
            col_fileName TEXT \
            )")

#Insert links into table
def data_entry():
    for filenames in list_Names:
        if filenames.endswith('txt'):
            c.execute("INSERT INTO namesTable(col_fileName) VALUES(?)", (filenames,))
    conn.commit()

data_entry()  # ==> call the function

#query database
c.execute("SELECT * FROM namesTable")
rows = c.fetchall()
for row in rows:
    print(row)

conn.close()

cd88bd9b586a4d0d0f5b96ff7e977805a8e0a4f2
<mask token>

<mask token>
c.execute(
    'CREATE TABLE IF NOT EXISTS namesTable(             ID INTEGER PRIMARY KEY AUTOINCREMENT,              col_fileName TEXT             )'
    )


def data_entry():
    for filenames in list_Names:
        if filenames.endswith('txt'):
            c.execute('INSERT INTO namesTable(col_fileName) VALUES(?)', (
                filenames,))
    conn.commit()


data_entry()
c.execute('SELECT * FROM namesTable')
<mask token>
for row in rows:
    print(row)
conn.close()

<mask token>
list_Names = ('information.docx', 'Hello.txt', 'myImage.png', 'myMovie.mpg',
    'World.txt', 'data.pdf', 'myPhoto.jpg')
conn = sqlite3.connect('Asgn_162.db')
c = conn.cursor()
c.execute(
    'CREATE TABLE IF NOT EXISTS namesTable(             ID INTEGER PRIMARY KEY AUTOINCREMENT,              col_fileName TEXT             )'
    )


def data_entry():
    for filenames in list_Names:
        if filenames.endswith('txt'):
            c.execute('INSERT INTO namesTable(col_fileName) VALUES(?)', (
                filenames,))
    conn.commit()


data_entry()
c.execute('SELECT * FROM namesTable')
rows = c.fetchall()
for row in rows:
    print(row)
conn.close()

import sqlite3
list_Names = ('information.docx', 'Hello.txt', 'myImage.png', 'myMovie.mpg',
    'World.txt', 'data.pdf', 'myPhoto.jpg')
conn = sqlite3.connect('Asgn_162.db')
c = conn.cursor()
c.execute(
    'CREATE TABLE IF NOT EXISTS namesTable(             ID INTEGER PRIMARY KEY AUTOINCREMENT,              col_fileName TEXT             )'
    )


def data_entry():
    for filenames in list_Names:
        if filenames.endswith('txt'):
            c.execute('INSERT INTO namesTable(col_fileName) VALUES(?)', (
                filenames,))
    conn.commit()


data_entry()
c.execute('SELECT * FROM namesTable')
rows = c.fetchall()
for row in rows:
    print(row)
conn.close()

import sqlite3

list_Names = ('information.docx', 'Hello.txt', 'myImage.png', \
                        'myMovie.mpg', 'World.txt', 'data.pdf', 'myPhoto.jpg')

#create a data structure
conn = sqlite3.connect('Asgn_162.db')
c = conn.cursor()

#Create table
c.execute("CREATE TABLE IF NOT EXISTS namesTable( \
            ID INTEGER PRIMARY KEY AUTOINCREMENT,  \
            col_fileName TEXT \
            )")

#Insert links into table
def data_entry():
    for filenames in list_Names:
        if filenames.endswith('txt'):
            c.execute("INSERT INTO namesTable(col_fileName) VALUES(?)", (filenames,))
    conn.commit()

data_entry()  # ==> call the function

#query database
c.execute("SELECT * FROM namesTable")
rows = c.fetchall()
for row in rows:
    print(row)

conn.close()
