Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

compter des valeur consecutives en python

>>> from itertools import groupby
>>> def groups(l):
...     return [sum(g) for i, g in groupby(l) if i == 1]
...
>>> groups([0,1,0,0,0])
[1]
>>> groups([0,0,1,1,0])
[2]
>>> groups([1,1,0,1,1])
[2, 2]
Comment

PREVIOUS NEXT
Code Example
Python :: notebook python static website generator 
Python :: pip upgrade command 
Python :: how to upgrade pip in cmd 
Shell :: remove steam from ubuntu 
Shell :: how to check laptop serial number in ubuntu 
Shell :: remove angular cli 
Shell :: stop nginx ubuntu 
Shell :: Please install the gcc make perl packages from your distribution. 
Shell :: how to install scikit learn python library 
Shell :: expo fix dependencies 
Shell :: install sklearn with conda 
Shell :: error gyp ERR! stack Error: not found: make 
Shell :: git set email and username 
Shell :: install rest framework 
Shell :: kill ubuntu port 
Shell :: conda install ipywidgets 
Shell :: pip install urllib 
Shell :: how to uninstall thunderbird ubuntu terminal 
Shell :: anaconda opencv install 
Shell :: ubuntu install vlc 
Shell :: ultimate power plan windows 10 
Shell :: update raspi 
Shell :: obs uninstall ubuntu 
Shell :: flush dns bash 
Shell :: refusing to merge unrelated histories bitbucket 
Shell :: restart ssh service 
Shell :: linux count files in directory 
Shell :: grafana cli restart 
Shell :: git ignore not working 
Shell :: how to install iis web using powershell 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =