[Level 28]
Title: many pairs ring-ring
RING-RING-RING say it out loud币砂,但沒say出什么來侦厚。
是 green。green.html顯示yes! green!吃既。取出G通道的數(shù)據(jù),成對(duì)相減大多數(shù)的絕對(duì)值為42荤傲,那么搜集絕對(duì)值不是42的數(shù)值旬牲,轉(zhuǎn)換為 ascii 碼优训。
from PIL import Image
img = Image.open('bell.png')
data = [d[1] for d in img.getdata()]
s = [abs(data[i]-data[i+1]) for i in range(0,len(data),2) if abs(data[i]-data[i+1])!=42]
print(bytes(s).decode())
得到:
whodunnit().split()[0] ?
whodunnit -> "Who [has] done it?" or "Who did it"。Python的作者是Guido van Rossum班缎,所以是guido蝴光,[Level 29]
小結(jié)
可以這樣取出G通道的數(shù)據(jù):
data = list(im.split()[1].getdata())
或這樣取出絕對(duì)值不為42的數(shù)據(jù):
diff = [abs(a - b) for a, b in zip(green[0::2], green[1::2])]
filtered = list(filter(lambda x: x != 42, diff))