Python - Lambda

From PeformIQ Upgrade
Revision as of 10:46, 31 January 2012 by PeterHarding (talk | contribs) (Created page with "=Examples= <pre> #!/usr/bin/env python27 crange = lambda c1, c2: [ chr(c) for c in range(ord(c1), ord(c2)+1) ] print crange('A', 'Z') print crange('0', '9') </pre> [[Cate...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Examples

#!/usr/bin/env python27

crange = lambda c1, c2: [ chr(c) for c in range(ord(c1), ord(c2)+1) ]

print crange('A', 'Z')
print crange('0', '9')