I am trying to do following operation using list comprehensions:
Input: [['hello ', 'world '],['foo ',' bar']]
Output: [['hello', 'world'], ['foo', 'bar']]
Here is how one can do it without list comprehensions:
a = [['hello ', 'world '],['foo ',' bar']]
b = []
for i in a:
   temp = []
   for j in i:
      temp.append( j.strip() )
      b.append( temp )
print(b)
#[['hello', 'world'], ['foo', 'bar']]
How can I do it using list comprehensions?
 
     
     
     
    