title: Python PostgreSQL using copy_from to COPY list of objects to table
body: <p>I'm using <code>Python 2.7</code> and <code>psycopg2</code> to connect to my DB server ( PostgreSQL 9.3 ) and I a list of objects of ( Product Class ) holds the items which i want to insert </p>
  
  <pre><code>products_list = []
  products_list.append(product1)
  products_list.append(product2)
  </code></pre>
  
  <p>And I want to use <code>copy_from</code> to insert this products list to the product table. I tried some tutorials and i had a problem with converting the products list to CSV format because the values contain single quote, new lines, tabs and double quotes. For example ( Product Description ) : </p>
  
  <pre><code>&lt;div class="product_desc"&gt;
      Details :
      Product's Name : name
  &lt;/div&gt;
  </code></pre>
  
  <p>The escaping corrupted the HTML code by adding single quote before any single quote and it, So i need to use a save way to convert the list into CSV to COPY it? OR using any other way to insert the list without converting it to CSV format??</p>