1 2 3 4 5 6 7 8 9
>>> res='' >>> for f in os.listdir(path): text = open(f, 'r').read() res += '\n'.join(re.findall('<fpc4:Str dt:dt="string">(.+)</fpc4:Str>', text)) + '\n' >>> result = open('results.txt', 'w') >>> result.write(res) >>> result.close() >>>