Re: [Tutor] Log file for Nested if-elif

2019-01-02 Thread Steven D'Aprano
On Wed, Jan 02, 2019 at 08:39:53PM +0530, Asad wrote: > Hi All , > > Need advice on the following piece of code : Let me write it in a more "Pythonic" style: PATCH = r'\?/patch/\d{8}/\d{8}/admin/load.sql' APPLY = r'Starting\s+apply\s+for\s+patch\s+\d{8}/\d{8}' ERROR = r'set_metadata' tail = d

[Tutor] Log file for Nested if-elif

2019-01-02 Thread Asad
Hi All , Need advice on the following piece of code : with open(r"file1.log", 'r') as f: tail = deque(maxlen=8) # the last eight lines script = None for line in f: tail.append(line) if re.search('\?/patch/\d{8}/\d{8}/admin/load.sql',line,re.IGNORECASE): sc