Python Forum
Print returns empty but no errors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print returns empty but no errors
#2
Just found if I move the last "IF" block to the top of the "IF" blocks the script prints all lines just fine.
What does it mean?
with open('C:\\02\\en15\\TST2\\Debug_1.log','r') as ftor:
    for ln in ftor:
        #print (ln)
        ln = ln.rstrip()
        
        if program_n in ln :
            #print ("Start Time Line -->> " , str_t1)
            *extraWords,prg_n = ln.split('Name') # Grtting program name line #            
            prg_n=prg_n.replace('"','')
            #print ("Program Name -->> " ,prg_n)
        
        if start_tm in ln:
            
            *extraWords,st_t1 = ln.split('Time') # Grtting Start Time line #
            st_t1=st_t1.replace('"','')           
            #print ("Start Time Line -->> " , str_t)
            #print (type(st_t1))
            
        if end_tm in ln:
            #print (ln) 
            *extraWords,endt1 = ln.split('Time') # Grtting END Time line #
            endt1=endt1.replace('"','')
            #print ("ENd Time line -->> " , endt1)            

            
        if runtime_l in ln:
            #print (ln) 
            *extraWords,rnt_1 = ln.split('Time') # Grtting Run Time line #
            rnt_1=rnt_1.replace('"','')
            ftow.write (st_t1 +endt1 + rnt_1 + prg_n + '\n')  # works here#

            print ("All Lines -->> "+st_t1 +endt1 + rnt_1 + prg_n + '\n')  # does not work here #

ftow.close()
Reply


Messages In This Thread
Print returns empty but no errors - by tester_V - Apr-19-2020, 06:26 PM
RE: Print returns empty but no errors - by tester_V - Apr-20-2020, 01:43 AM
RE: Print returns empty but no errors - by tester_V - Apr-20-2020, 04:48 AM
RE: Print returns empty but no errors - by tester_V - Apr-20-2020, 06:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How returns behave in a function with multiple returns? khasbay 1 181 May-19-2024, 08:48 AM
Last Post: deanhystad
  Inspect.getmembers with isclass returns an empty list Aldar 1 2,837 Oct-02-2019, 01:48 PM
Last Post: Aldar
  Writing chr(128) to text file returns errors. Qwert_Yuiop 5 4,610 Aug-07-2018, 03:52 PM
Last Post: snippsat
  How to remove empty line between two print functions BigEasy 1 2,408 Feb-07-2018, 08:38 AM
Last Post: buran
  Empty variable when using print before readline fstefanov 3 3,716 Oct-23-2017, 02:22 AM
Last Post: fstefanov

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020