This commit is contained in:
ludo 2021-10-06 09:32:17 +02:00
parent 1b80141dc4
commit b82576d49e
2 changed files with 23 additions and 0 deletions
sio2/sisr/20-python

13
sio2/sisr/20-python/cptmot.py Executable file

@ -0,0 +1,13 @@
#!/usr/bin/python3
phrase = input('Phrase : ')
tabmot = phrase.split(' ')
cptmot = {}
for mot in tabmot :
if mot in cptmot :
cptmot[mot] = cptmot[mot] + 1
else :
cptmot[mot] = 1
for key in cptmot.keys() :
print (key, " ", cptmot[key])

10
sio2/sisr/20-python/log.py Executable file

@ -0,0 +1,10 @@
#!/bin/usr/python3
import re
import sys
group = {}
regexp = '^(\S+) (\S+) (\S+) \[([^]]+)\] "(\w+) (\S+).*" (\d+) (\S+)'
for line in sys.stdin:
line = line.rstrip ( )
match = re.match (regexp, line)
if match:
print (match.group(1)," ",match.group(8))