teil25 vom develop
This commit is contained in:
21
teil25/filter_vornamen.py
Normal file
21
teil25/filter_vornamen.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from vornamen_reader import read_vornamen
|
||||
import re
|
||||
|
||||
def print_vornamen_simple(vornamen):
|
||||
for vorname in vornamen:
|
||||
print(vorname)
|
||||
|
||||
def print_vornamen_filtered(vornamen,regex):
|
||||
pattern = re.compile(regex)
|
||||
for vorname in vornamen:
|
||||
# print(f"{type(r)}: {r}")
|
||||
# s = re.findall(regex,vorname)
|
||||
# if s[0] != '':
|
||||
is_match = pattern.match(vorname).span()[1] >0
|
||||
if is_match:
|
||||
print(f'{is_match}: {vorname}')
|
||||
|
||||
vornamen = read_vornamen('./Vornamen_Wuppertal_2020.csv')
|
||||
|
||||
#print_vornamen_simple(vornamen)
|
||||
print_vornamen_filtered(vornamen,'O*')
|
||||
Reference in New Issue
Block a user