What I learned today
Dan Stromberg
drsalists at gmail.com
Fri Feb 14 18:21:19 EST 2020
On Fri, Feb 14, 2020 at 3:10 PM Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> By trial and error (never read documentation!) I found
> that you can count the number of e's in a text by just
>
> Counter( text ).get( 'e' )
>
> (after »from collections import Counter« that is).
>
Even simpler, though not suitable for all situations:
"abcbdbe".count("b")
The other thing I read in a book. I already knew that one
> can zip using ... »zip«. E.g.,
>
Neat.
More information about the Python-list
mailing list