jeudi 6 décembre 2018

How to combine if else with try except in python

I have list of functions inside my class MyMatch and i am having indent error while combining the try except with the if else inside the function

this is MyMatch Class

class MyMatch(object):
    def __init__(self, match_id):
         self.followon = self._followon()

   def _followon(self):
      try:
          if self.match_json()['followon'] == '1':
              return True
      except:
          else:
              return False

I am having indent error in the else block of followon function

Aucun commentaire:

Enregistrer un commentaire