The longest word

Piet van Oostrum piet at cs.uu.nl
Tue Jul 28 11:36:46 CEST 2009


>>>>> NiklasRTZ <niklasro at gmail.com> (N) wrote:

>N> Thank you. This seems to work:
>N> sorted("a AAA aa aaaaa  sdfsdfsdfsdf vv".split(' '),lambda a,b: len(a)-
>N> len(b))[-1]
>N> 'sdfsdfsdfsdf'

simpler:

sorted("a AAA aa aaaaa  sdfsdfsdfsdf vv".split(' '), key=len)[-1]
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list