A rather unpythonic way of doing things

Rocco Moretti roccomoretti at hotpop.com
Thu Sep 29 11:10:34 EDT 2005


fraca7 wrote:
> Richie Hindle a écrit :
> 
>> [Peter]
>>
>>> http://www.pick.ucam.org/~ptc24/yvfc.html
>>
>>
>>
>> [Jeff]
>>
>>> Yuma Valley Agricultural Center?
>>> Yaak Valley Forest Council?
>>
>>
>>
>> I went through the same process.  My guess is "Yes, Very F'ing Clever."
>> Peter?
>>
> 
> print ''.join(map(lambda x: chr((((ord(x) - ord('a')) + 13) % 26) + 
> ord('a')), 'yvfc'))

Less pythonic:

__import__('sys').stdout.write(''.join(map(lambda x: chr((((ord(x) - 
ord('a')) + 13) % 26) + ord('a')), 'yvfc'))

More Pythonic:

print 'yvfc'.decode('rot13')



More information about the Python-list mailing list