Created
February 12, 2020 04:25
-
-
Save jaganadhg/e2956b3d4b3f61ca7dad12f70a95438a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from collections import Counter | |
data = ["/mnt/volume1/vol/img.img","/mnt/volume1/some.img","/mnt/volume2/simg.img"] | |
def match_volume(input_data,search_patten): | |
regex_patt = re.compile(search_patten) | |
macthed_gen = [regex_patt.search(inp) for inp in input_data] | |
match_count = Counter(mtch.group() for mtch in macthed_gen if mtch) | |
return match_count | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment