extracting words from a complex multiparagraph document and output them as a multiline comma separated file

Ok folks. Here is how it ended up with. Big thanks for the help given by CYREX and xelf (Reddit).

with open('Softberry.txt') as f:
    for line in f:
        if line.startswith(' QUERY:'):
            query = line.split(':', 1)[1].strip()
        if 'AC:' in line:
            ac = line.split('AC:')[1].split(':')[0].strip()

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top