Here is my problem. I have a complex text file with 32 articles. Since each article starts with 1 out of 32 DOCUMENTS, 2 out of 32 DOCUMENTS etc, using the following code I split the text into the different articles using:

```
import re 
sections = [] 
current = []
with open("Aberdeen2005.txt") as f:
    for line in f:
        if re.search(r"(?i)\d+ of \d+ DOCUMENTS", line):        
           sections.append("".join(current))
           current = [line]
        else:
           current.append(line)

print(len(sections)) 

```

I am now trying to extract the date of each article. I have noticed that the date is either in the 4th or the 5th line of the beginning of each article. Therefore I manage to create a function with this relevant lines by: 

```
def main():
    for i in range(len(sections)): 
        date_row4 = (sections[i].split("\n")[4].split(" "))     
        date_row5 = (sections[i].split("\n")[5].split(" "))

        print(date_row4)
        print(date_row5)

```

Which gets me the following list:
[![list retrieved by running the above code](https://i.stack.imgur.com/XzXD2.png)](https://i.stack.imgur.com/XzXD2.png)

What I am trying to find now, is the month and the year only by using the following:

```
months = 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'

month = re.findall(r' \w+ months',date_row4 or date_row5)
year = re.findall(r' \d^20', date_row4 or date_row5 )

```

Nevertheless, is not working. I just started to learn Python so there are so many things that I can imagine are going wrong. Any help would be much appreciate it.

Kind regards,

Andres