Hello,
I need to make a script in order to parse files in a shared folder on windows, making tests of pattern and add results in a table.
In a few words, for each log file, 2 things
if pattern is found -->ok
if pattern is not found --->add error in a table(which will be an html file) with username,email,id of the computer
Here below the script i'm writing
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os.path
import re
data_folder = os.path.join(r"\\shared folder")
file_to_open = os.path.join(data_folder, "*.LOG")
f = open(file_to_open,encoding="utf-8", errors='ignore')
print(f.read())
##controles et actions associes####
## fenetres contextuelles
string = "toto.toto.fr"
regexp = re.findall( r'(^[a-z0-9._-]+@[a-z0-9._-]+\.[(com|fr)]+)')
if re.match(regexp, string) is not None:
print ('TRUE')
else:
print ('FALSE')
etc...
questions
1) how can i write that the script need to parse a shared folder on windows?
2) I've problem with UTF8 and i don't find how to encode it properly?
3) HOW making test pattern and add result in a table (as output)?
Thank you for your help
I need to make a script in order to parse files in a shared folder on windows, making tests of pattern and add results in a table.
In a few words, for each log file, 2 things
if pattern is found -->ok
if pattern is not found --->add error in a table(which will be an html file) with username,email,id of the computer
Here below the script i'm writing
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os.path
import re
data_folder = os.path.join(r"\\shared folder")
file_to_open = os.path.join(data_folder, "*.LOG")
f = open(file_to_open,encoding="utf-8", errors='ignore')
print(f.read())
##controles et actions associes####
## fenetres contextuelles
string = "toto.toto.fr"
regexp = re.findall( r'(^[a-z0-9._-]+@[a-z0-9._-]+\.[(com|fr)]+)')
if re.match(regexp, string) is not None:
print ('TRUE')
else:
print ('FALSE')
etc...
questions
1) how can i write that the script need to parse a shared folder on windows?
2) I've problem with UTF8 and i don't find how to encode it properly?
3) HOW making test pattern and add result in a table (as output)?
Thank you for your help