The file contains:
3
7 4
2 4 6
8 5 9 3
output: [[3],[7,4],[2,4,6],[8,5,9,3]]
my output:
 [[3], [7, 4], [2, 4, 6], [8, 5, 9, 3]]    
      ^       ^          ^             // don't want these spaces
my solution:
def read_triangle(filename):
    f = open(filename,'r')
    triangle = []
    for line in f:
        splited = line.split()
        triangle.append([])
        for num in splited:
            triangle[-1].append(int(num))           
    f.close()
    return triangle
what do i have to do to remove spaces?
 
     
    