title: List of filenames to sqlite with Python
body: <p>I'm trying to populate an sqlite3 database with a list of filenames from a directory using Python. I'm not sure why this is not working:</p>
  
  <pre><code>conn = sqlite3.connect( "databasefile.db" )
  cur = conn.cursor()
  cur.execute('CREATE TABLE IF NOT EXISTS filenames (filename TEXT)')
  for root, dirnames, filenames in os.walk(directory):
      for filename in filenames:
          if filename.endswith(".ext"):
              cur.executemany('INSERT INTO filenames (filename) VALUES (?)', (filename))
              conn.commit()
  </code></pre>
  
  <p>I'd like it to produce this in the database file:</p>
  
  <pre><code>   Column
  1  1st.ext
  2  2nd.ext
  3  3rd.ext
  </code></pre>
  
  <p>But instead it results in this:</p>
  
  <pre><code>   Column
  1  1
  2  r
  3  s
  4  t
  5  .
  6  e
  7  x
  8  t
  9  2
  10 n
  11 d
  12 .
  
  etc.
  </code></pre>
  
  <p>Could anyone help me understand where I'm going wrong?</p>
  
  <p><strong>EDIT:</strong> Thank you, I didn't realize iterating over a string gives the individual characters. Added the comma to make 'filename' a tuple and resolved.</p>