Aug-22-2022, 09:04 PM
Thank you guys!
I appreciate your help!
I'm really not that good with programming.
I came up with a simple (for me) solution that seems working fine.
I probably invented a bicycle...
Here is the code:
I love this forum
I appreciate your help!
I'm really not that good with programming.
I came up with a simple (for me) solution that seems working fine.
I probably invented a bicycle...
Here is the code:
import re import linecache fl = 'C:/01/last_line.txt' with open(r"C:/01/last_line.txt") as mfiler: lnc = 0 # <-- Line Numners frt_ln = mfiler.readline() # <------------------ First Line print(f" Fl -> {frt_ln}") for rn_l in mfiler: lnc+=1 if 'Start' in rn_l : continue # do something with the lines la_line = rn_l while (lnc) > 0 : print(f" Number of Ln in the File = {str(lnc)}") # < --- Number of lines in the file if re.search('^\d+', la_line) : print(f" LN has DT --> {la_line} ") lnc = 0 break else : lnc = lnc -1 la_line = linecache.getline('C:/01/last_line.txt', lnc)Thank you again!
I love this forum