As you can see, all the examples are without regulars, as they say in a famous meme: if you decide to solve a problem with regular expressions, then you have 2 problems. xD
in_str = ''' А Б 2000.1.9 В Г 2001.6.7 Д Е 2000.7.5 Ж З 2005.9.4 И К 1999.6.4 '''; # in_list содержит строки из файла, для удобства я сделал через in_str in_list = list(filter(lambda x: x != '', in_str.split("\n"))); out_list = []; for string in in_list: item = string.split(' ')[2].split('.'); out_list.append(item); print(out_list);
Conclusion:
[['2000', '1', '9'], ['2001', '6', '7'], ['2000', '7', '5'], ['2005', '9', '4'], ['1999', '6', '4']]
UPD0: So that the list contains dates, not strings , you can do this:
in_str = ''' А Б 2000.1.9 В Г 2001.6.7 Д Е 2000.7.5 Ж З 2005.9.4 И К 1999.6.4 '''; # in_list содержит строки из файла, для удобства я сделал через in_str in_list = list(filter(lambda x: x != '', in_str.split("\n"))); out_list = []; for string in in_list: item = list(map(int, string.split(' ')[2].split('.'))); out_list.append(item); print(out_list);
Conclusion:
[[2000, 1, 9], [2001, 6, 7], [2000, 7, 5], [2005, 9, 4], [1999, 6, 4]]
UPD1: It seems I didn’t quite understand what was needed, if you just need a list of dates in the form of strings, you can:
in_str = ''' А Б 2000.1.9 В Г 2001.6.7 Д Е 2000.7.5 Ж З 2005.9.4 И К 1999.6.4 '''; # in_list содержит строки из файла, для удобства я сделал через in_str in_list = list(filter(lambda x: x != '', in_str.split("\n"))); out_list = []; for string in in_list: item = string.split(' ')[2]; out_list.append(item); print(out_list);
Conclusion:
['2000.1.9', '2001.6.7', '2000.7.5', '2005.9.4', '1999.6.4']