title: How can i separate the text to another column in a database from a .txt file ? (the delimiter is a string)
body: <p>I got a .txt file like this:
  "Rock also know as: Alternative rock"
  I need to import that to a database using sqlite3 and python.
  Each type in a different column like:</p>
  
  <p>Rock       |             Alternative Rock</p>
  
  <p>Thanks.</p>
  
  <p>|: separate columns.</p>
  
  <pre><code>import sqlite3
  conn = sqlite3.connect('chinook(1).db')
  cur = conn.cursor()
  
  
  file=open('subgenres3.txt','r') 
  try: 
          file = open('subgenres3.txt', 'r') 
  except: 
      print("file not found")  
  
  f=file.read()
  f=f.split("\n")   
  
  
  
  for line in f:  
      cur.execute("INSERT INTO subgénero (subgenrename,subgenrealtname) VALUES (?,?)", (line,line)) 
  
  conn.commit() 
  conn.close()
  </code></pre>