Closed ghghgh0001 closed 6 years ago
I delete the "*" before "rgb", and it works, is it correct? It's not correct. I change them to : x_pos, y_pos, r, g, b = pixel img[x_pos, y_pos] = [r, g, b] seems ok.
It seems that you're running a version of Python that does not support Extended Iterable Unpacking. According to this StackOverflow post, it should work with Python 3.0+.
Are you sure you are running with Python 3? There shouldn't be a syntax error in that case. You can check by writing the following code in a cell:
import platform
print(platform.python_version()) # Should be 3.x.x
If you are still running across this issue, the code
x_pos, y_pos, r, g, b = pixel
img[x_pos, y_pos] = r, g, b
should be equivalent.
I changed the kernel of jupyter to python3, but it doesn't work, and I updated my jupyter, but it still no use.
x_pos, y_pos, r, g, b = pixel img[x_pos, y_pos] = [r, g, b]
I write them like this, is it the same?
I change the kernal of jupyter to python3, but it still 2.7.12, seems something wrong with my jupyter. I copy the code to a .py file, and use python3 to open it in the terminal, and there's no problem now. Thanks for answering my silly problem. :)
File "helper.py", line 32 x_pos, y_pos, *rgb = pixel ^ SyntaxError: invalid syntax I met this problem while running the "imports" of "1_one-pixel-attack-cifar10", with both python2 and python3.