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
#3
I assume you are talking about the print ("All Lines -->>…

Initially 'st+t1, endt1, rnt_1, and prg_n are all ' '. If runtime_l is encountered before start_tm or end_tm or program_n, the print statement will print a bunch of blanks. Moving the "if program_n in ln: does nothing to change the logic of the program. It should act exactly the same way. However you also moved the print from one "if" to another. I can only guess, but I think you want to have the print statement outside the for loop. That way it will wait for all lines to be processed before printing.

By the way, the "ftow.close)_" is not needed. The "with open..." creates a context for the file. When the program exits the context the file automatically closes. It would even close if there was an exception that caused the program to fail.
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 deanhystad - Apr-20-2020, 03:56 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 314 May-19-2024, 08:48 AM
Last Post: deanhystad
  Inspect.getmembers with isclass returns an empty list Aldar 1 2,909 Oct-02-2019, 01:48 PM
Last Post: Aldar
  Writing chr(128) to text file returns errors. Qwert_Yuiop 5 4,775 Aug-07-2018, 03:52 PM
Last Post: snippsat
  How to remove empty line between two print functions BigEasy 1 2,472 Feb-07-2018, 08:38 AM
Last Post: buran
  Empty variable when using print before readline fstefanov 3 3,814 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