Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
try and except
#4
Quote:
 if line.startswith (city): 

That line doesn't throw an error if it doesn't find the substring, it just returns False.  try/except catch errors, full stop.  If there's no error, an except block will not run.
Reply


Messages In This Thread
try and except - by anonymouspanda - Oct-30-2017, 08:52 PM
RE: try and except - by Lux - Oct-30-2017, 09:26 PM
RE: try and except - by anonymouspanda - Oct-31-2017, 06:32 PM
RE: try and except - by nilamo - Oct-31-2017, 07:26 PM

Forum Jump:

User Panel Messages

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