易截截图软件、单文件、免安装、纯绿色、仅160KB

涉水The Python Challenge

在Stack Overflow 上看到学习Python 的一个方法是用Python 破解The Python Challenge。但我喜欢用Ruby,谁管得着呢^_^
0. 入门关很简单。
p 2**38 
1. 破解一段话,观察图片很容易发现解码表把字母表循环右移两位。
riddle = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
riddle.scan(/./).each do |char|
if /[a-z]/ =~ char
print (?a + (char[0] - ?a + 2) % 26).chr
else
print char
end
end 
译文:i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url.
再对url ("map")实施变换得"ocr"。
update: 发现String有个内置替换函数tr()。看,多简洁。
class String
def rot2
self.tr("a-xyz","c-zab")
end
end
p riddle.rot2 
2. 查看网页源码,可以看到网页注释中有一堆乱码,上面有句话"find rare characters in the mess below:"(“找出稀少的字符”)。想到用hash 来统计各个字符的出现次数,并记录首次出现的顺序。
riddle = '...' # the mess here
count = Hash.new(0)
seq = []
riddle.scan(/./).each do |char|
seq << char if count[char] == 0
count[char] += 1
end
p count, seq 
你会得到"equality"。第三关,我来了!


相关文档:

python下的web开发框架 Django,创建项目

解压django,然后到其目录下安装
前提是你安装好python.并将其配置到环境变量中,然后去django的压缩文修的下,执行以下倒命令
python setup.py install
1.创建project
首先我们打开cmd, 定位到希望新建工程的目录下, 任意目录均可. 然后键入如下命令:
django-admin.py startproject hello其中hello为新工程目录文件名 ......

关于Python中一种回调方式的实现

#关于回调功能的测试
#Functor是这种回调功能的关键对象
class Functor:
    """Simple functor class."""
    def __init__( self, fn, *args ):
        self.fn = fn
        ......

转段Python代码

#==================================================
import wx
import wx.media

class MyFrame(wx.Frame):
def __init__(self,parent,title):
wx.Frame.__init__(self,parent,-1,title,pos=(150,150),size&;nbsp;=(640, 480),style=wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX| ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号