title: Finding unique elements in nested list
body: <p>If I have a list <strong>mylist = ["[amn,b,c]", "[‘a,d,e’]", "[‘f,b,e’]"]</strong>, and I need to a single list with all the unique elements as <strong>[amn,b,c,d,e,f]</strong>, how can I accomplish that?</p>
  
  <p>I have tried creating a function and also tried some other method, but to no avail.</p>
  
  <p><strong><em>Function:</em></strong> </p>
  
  <pre><code>mylist = ["[amn,b,c]", "[‘a,d,e’]", "[‘f,b,e’]"]
  
  def print_list(the_list):
  
  for each_item in the_list:
  
      if isinstance(each_item, list):
  
          print_list(each_item)
  
      else:
  
          print(each_item)
  
  print_list(mylist)
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>[amn,b,c]
  
  [‘a,d,e’]
  
  [‘f,b,e’]
  </code></pre>
  
  <p><strong><em>Other method:</em></strong></p>
  
  <pre><code>mylist = ["[amn,b,c]", "[‘a, d,e’]", "[‘f,b,e’]"]
  
  mylist = str(mylist)
  
  mylist = str(mylist)
  
  mylist = [str(x) for x in (mylist)]
  
  mylist = set(mylist)
  
  i = {' ', "'", ',', '[', ']','‘', '’'}
  
  mylist.difference_update(i)
  
  mylist = list(mylist)
  
  mylist.sort()
  
  mylist
  </code></pre>
  
  <p><strong>Output:</strong> </p>
  
  <pre><code>['a', 'b', 'c', 'd', 'e', 'f', 'm', 'n']
  </code></pre>
  
  <p><strong>Expected Results:</strong> </p>
  
  <pre><code>[amn,b,c,d,e,f]
  </code></pre>
  
  <p><strong>Actual Results:</strong></p>
  
  <p><strong><em>With the function:</em></strong></p>
  
  <pre><code>[amn,b,c]
  
  [‘a,d,e’]
  
  [‘f,b,e’]
  </code></pre>
  
  <p><strong><em>With the other method:</em></strong></p>
  
  <pre><code>['a', 'b', 'c', 'd', 'e', 'f', 'm', 'n']
  </code></pre>