integer to binary...

Sion Arrowsmith siona at chiark.greenend.org.uk
Fri Jun 2 11:14:56 EDT 2006


Tim Chase  <python.list at tim.thechases.com> wrote:
>bitCount = len([c for c in "01001010101" if c=="1"])

bitCount = "01001010101".count("1")

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list