hex = lambda s: ''.join(map(lambda c: "%02X" % ord(c), s))
这是一个lambda的嵌套,我们可以分解成以下代码,就比较好理解了:
def char2Hex(c): return '%02X' % ord(c) def toHexList(s): return map(char2Hex, s) def toHex(s): return ''.join(toHexList(s))
posted on 2012-09-13 13:40 盐味 阅读(317) 评论(0) 编辑 收藏 举报