a = array((1, 2, 3))print a>>> array([1, 2, 3])tuple(a)>>> (1, 2, 3)
Pretty lame right?
If you load a GIF file with PIL via Image.open(‘giffile.gif’) and then try to look at its pixels, you would get integers instead of tuples since the GIF pixels refers to one of the 256 colours in the GIF colour palette. The palette would then contain the RGB value of the pixel.
Suppose you want to make some web app that lets users input addresses. I would be nice to
Used a NumPy array. Doesn’t work if the diagonal+1s are white of course.
import Imagefrom numpy import array, zeros, uint8
line = Image.open('wire.png')# third dimension is for coloursa = zeros((100, 100…
A quickie:
import ipdb; ipdb.set_trace()
This puts a breakpoint in the code using ipdb. It has the advantage of having better formatted output, tab completion etc over the vanilla pdb
Got a Logitech Performance MX on “special” at Best Buy this weekend (80$ for a mouse… what a slaughter) because I just have a laptop mouse and am tired of not having anything to rest my palm on. At first, it’s great. Looks like a race car, good performance, nice receiver…