title: How to remove spaces from list of lists in Python?
body: <p>I have the following input:</p>
  
  <pre><code>[ ['A(x) | B(x)'],['Function(x,y) | K(x)'] ]
  </code></pre>
  
  <p>Each list within the list of list has a space before and after the character "|". How can I remove this to get the following result?</p>
  
  <pre><code>[ ['A(x)|B(x)'],['Function(x,y)|K(x)'] ]
  </code></pre>
  
  <p>I tried the following:</p>
  
  <pre><code>list=[]
  k1=[]
  for i in sentence:
      k1="".join(i).replace(" ","")
      list.append(k1)
  
  result=[[i] for i in list]
  </code></pre>