title: Python File Read + Write
body: <p>I am working on porting over a database from a custom MSSQL CMS to MYSQL - Wordpress. I am using Python to read a txt file with <code>\t</code> delineated columns and one row per line.</p>
  
  <p>I am trying to write a Python script that will read this file (fread) and [eventually] create a MYSSQL ready .sql file with insert statements.</p>
  
  <p>A line in the file I'm reading looks something like:</p>
  
  <pre><code>1    John Smith    Developer  http://twiiter.com/johns   Chicago, IL
  </code></pre>
  
  <p>My Python script so far:</p>
  
  <pre><code>import sys
  
  fwrite = open('d:/icm_db/wp_sql/wp.users.sql','w')
  
  fread = open('d:/icm_db/users.txt','r')
  
  for line in fread:
      print line;
  
  
  fread.close()
  fwrite.close()
  </code></pre>
  
  <p>How can I "implode" each line so I can access each column and do business on it?</p>
  
  <p>I need to generate multiple MYSQL insert statements per line I read. So... for each line read, I'd generate something like:</p>
  
  <pre><code>INSERT INTO `wp_users` (`ID`, `user_login`, `user_name`) 
  VALUES (line[0], 'line[2]', 'line[3]');
  </code></pre>