title: Parse delimited csv file using Python, output to terminal or file
body: <p>I have been working on a Python script to parse a single delimited column in a csv file. However, the column has multiple different delimiters and I can't figure out how to do this.</p>
  
  <p>I have another script that works on similar data, but can't get this one to work. The data below is in a single column on the row. I want to have the script parse these out and add tabs in between each. Then I want to append this data into a list with only the unique items. Typically I am dealing with several hundred rows of this data and would like to parse the entire file and then return only the unique items in two columns (one for IP and other for URL).</p>
  
  <p>Data to parse: 123.123.123.123::url.com,url2.com,234.234.234.234::url3.com (note ":" and "," are used as delimiters on the same line)</p>
  
  <p>Script I am working with:</p>
  
  <pre><code>import sys
  import csv
  
  csv_file = csv.DictReader(open(sys.argv[1], 'rb'), delimiter=':')
  
  uniq_rows = []
  
  for column in csv_file:
      X = column[' IP'].split(':')[-1]
      row = X + '\t' 
  
      if row not in uniq_rows:
          uniq_rows.append(row)
  
  for row in uniq_rows:
      print row
  </code></pre>
  
  <p>Does anyone know how to accomplish what I am trying to do?</p>