In Python what will be the output of below code snippet?

 

Input stream:
2019/3 03 = VAR 45,79,116,86,17,442,45
2019/6 03 = VAR 45,97,13,53,37,32,15
2014/3 03 = VAR 35,77,56,83,34,432,89
2020/3 03 = VAR 455,77,99,85,32,43,25
2016/3 03 = VAR 43,77,96,82,37,44,55

Code snippet:
import re

found = re.findall(r'(\d\d\d\d)/\d\d? ', text)
print(found)


The output of the above code snippet with the pattern is below :

['2019', '2019', '2014', '2020', '2016']

 


Related #tags:     #python     #regex    

Related questions




Looking for change? Click below to prepare for technical interview.


Technical Interview Questions