I would like to save my results in my csv. But somehow it remains empty. But if I write the same output not in the csv and only print I get my results As I would like it to have.
import re
import glob
import os
## is the second script for matchParser.py, match the results for Duration in ms digit
lines = [line.strip() for line in open('output.csv')]
for result in lines:
match = re.search(r'(!?\s.\d[Request completed in\s])', result)
if match: print match.group(0)
but this version with the output_csv is not working, i dont know why..
import re
import glob
import os
lines = [line.strip() for line in open('output.csv')]
for result in lines:
match = re.search(r'(!?\s.\d[Request completed in\s])', result)
with open('outputREGEX5.csv', "w") as output_csv:
if match: output_csv.write(match.group(0))
I also get the following error:
output.write(match.group(0))
AttributeError: 'NoneType' object has no attribute 'group'
Am grateful for any help.
--
EDIT
My print Output:
44
37
53
35
17
35
25
27
50
31
27
36
17
66
46
41
38
23
33