Python Challenge[33]

2017-03-24  本文已影响0人  Recgat

[Level 33]


Title: 33 bottles of beer on the wall

最终从源码中得到 beer2.png。结合之前的提示

If you are blinded by the light,
remove its power, with its might.
Then from the ashes, fair and square,
another truth at you will glare.

嗯,没懂。去除亮点,剩余的数是平方数,重新组成图。

from PIL import Image
import math

with Image.open('beer2.png') as img:
  data = list(img.getdata())
for i in range(254, -1, -1):
  imgData = [d for d in data if d < i]
  x = math.sqrt(len(imgData))
  if x == int(x) and x > 0:
    newImg = Image.new('L', (int(x), int(x)))
    newImg.putdata(imgData)
    newImg.save('img/'+str(x)+'.png')

得到好多个字母,外边有方框的字母组成 gremlinsTemporary End

Python Challenge Wiki

上一篇 下一篇

猜你喜欢

热点阅读