Question: how do I flatten this list:

```
irr_list = [[[u'Animal Collective'], u'Lion in a Coma'], [[u'Animal Collective'], u'Hocus Pocus'], [[u'Animal Collective'], u'Vertical'], [[u'Animal Collective'], u'Natural Selection'], [[u'Animal Collective'], u'Spilling Guts'], [[u'Animal Collective'], u'Recycling']]

```

for this desired output?

```
output = [[u'Animal Collective', u'Lion in a Coma'], [u'Animal Collective', u'Hocus Pocus'], [u'Animal Collective', u'Vertical'], [u'Animal Collective', u'Natural Selection'], [u'Animal Collective', u'Spilling Guts'], [u'Animal Collective', u'Recycling']]

```

I have tried :

```
flattened = [val for sublist in irr_list for val in sublist]

```

to no avail

Answer: 
I think you can use this

```
def TileImage(image,rows,cols):
imagename = image
im = Image.open(imagename) 
width, height = im.size
indexrow = 0
indexcolum = 0
left = 0
top = 0
right = width/col
buttom = 0
while(right<=width):    
    buttom = height/rows
    top = 0
    indexrow=0  

    while(top<height):
        print(f"h : {height}, w : {width}, left : {left},top : {top},right : {right}, buttom   :  {buttom}")
        cropimg= im.crop((left, top, right, buttom)) 
        cropimg.save(imagename + str(indexrow) + str(indexcolum) +".jpg")
        top = buttom
        indexrow += 1
        buttom += height/rows   

    indexcolum+=1
    left = right
    right += width/col 

```
I prefer to calculate the number of tiles beforehand and then use a simple reshape. For example

```
tile = 512
img_height = img.shape[1]
img_width = img.shape[0]
number_of_vertical_tiles = img_height // tile
number_of_horizontal_tiles = img_width // tile
cropped_img = img[:tile*number_of_vertical_tiles, :tile*number_of_horizontal_tiles,:]
tiled_img = img.reshape(-1, tile, tile, 3)

```