title: How to prevent Python strings being split() if the delimiter is surrounded by brackets
body: <p>I am working on a bit of code that loops through a txt file and creates a list containing individual lines. I need specific content from each line, where a comma is used as a delimiter. However, I run into an issue when there is a comma in one of the list items. The list comprehension line separates this single item into two items. The item, author, is enclosed in brackets. Can I have the list comprehension overlook items contained in brackets perhaps?</p>
  
  <pre><code>    inventory = open("inventory.txt").readlines()
      seperated_inventory = [x.split(",") for x in inventory]
      isbn_list = [item[0] for item in seperated_inventory]
      author_list = [item[1] for item in seperated_inventory]
      title_list = [item[2] for item in seperated_inventory]
      category_list = [item[3] for item in seperated_inventory]
      active_list = [item[4] for item in seperated_inventory]
  </code></pre>
  
  <p>example of line with two authors</p>
  
  <p><code>0520085477,['Richard L. Abel', 'Philip Simon Coleman Lewis'],Lawyers in Society,['Law’],False</code></p>