美文网首页
Python Challenge[9]

Python Challenge[9]

作者: Recgat | 来源:发表于2017-02-09 16:25 被阅读0次

[Level 9]


Title: connect the dots

图中有黑点,再无其他提示。查看源码,第二处注释:

first+second=?

下面给出了first和second,为一组数字。那么如何相加?查找Image模块,并没有头绪。

from PIL import Image,ImageDraw
img = Image.open('good.jpg')
newImg = Image.new('L',img.size)
draw = ImageDraw.Draw(newImg)
draw.line(first,fill=255)
draw.line(second,fill=255)
newImg.show()

这样“相加”后,得到一头牛的图片:


最终是bull[Level 10]

小结

first和second的数据用列表存储。或者这样相加:

all = first+second
for i in range(0,len(all),2):
  newImg.putpixel((all[i],all[i+1]),255)
  1. PIL.Image.new(mode, size, color=0)创建指定模式的图片,L表示8-bit pixels, black and white
  2. class PIL.ImageDraw.Draw(im, mode=None)创建一个可在给定图片绘画的对象。
  3. PIL.ImageDraw.Draw.line(xy, fill=None, width=0)在给定的坐标中画线。

Python Challenge Wiki

除了copy和paste数据,还有其他办法。

More

相关文章

  • The Python Challenge(9)

    问题链接 问题链接如下: 答案链接 答案链接如下: 登陆用户名密码为huge和file。 解题思路 阅读源码有如下...

  • Python Challenge[9]

    [Level 9] Title: connect the dots 图中有黑点,再无其他提示。查看源码,第二处注释...

  • Python挑战:00~03关

    Python Challenge Python Challenge 00 网址: http://www.pytho...

  • Python挑战:04-05关

    Python Challenge Python Challenge 04 现在,我们来挑战第四关,从第三关的结果,...

  • [Python Challenge通关]第9关 connect

    挑战地址,点我 分析 右键查看网页源码,可以看到提示: first 和 second 是两组数,图片上还有一些黑点...

  • python马丁challenge9.Finding parti

    Insert your code into triples_1.py so as to find all trip...

  • The Python Challenge(5)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 根据页面源码提示: 再点击页面图片显示: 可知是需要...

  • The Python Challenge(8)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 页面和源码中无任何提示,但图片中有一条很明显的灰度线...

  • The Python Challenge(2)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 将页面给定的字符串根据给定规则进行替换即可,规则如下...

  • The Python Challenge(3)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 根据页面提示: 阅读源码,有如下内容: 编写代码从中...

网友评论

      本文标题:Python Challenge[9]

      本文链接:https://www.haomeiwen.com/subject/zdwiittx.html