Artificial intelligent assistant

内包表記をベタに開いて書く Python, OpenCV > > imgs = [Image.fromarray(mosaic(src, 1 / i)) for i in range(1, 25)] > `imgs =` for i in range(1, 25): Image.fromarray(mosaic(src, 1 / i)) for i in range(1, 25): imgs += Image.fromarray(mosaic(src, 1 / i)) UnboundLocalError: local variable 'imgs' referenced before assignment


Python

> for
>
>
> squares = [i**2 for i in range(5)]
> print(squares)
> # [0, 1, 4, 9, 16]
>
>
> * * *
>
>
> squares = []
> for i in range(5):
> squares.append(i**2)
>
> print(squares)
> # [0, 1, 4, 9, 16]
>




imgs = []
for i in range(1, 25):
imgs.append(Image.fromarray(mosaic(src, 1 / i)))



python

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 9f273d14228f3c944b895dc7c7d44043