сут в следующем, например, есть на php такой код
if($this->id == 0) throw new Exception('ERROR: your ID is empty'); elseif($this->balance == 0) throw new Exception('ERROR: your BALANCE is empty'); elseif(mb_strlen($this->name) == 0 or $this->name == '') throw new Exception('ERROR: your NAME is empty'); elseif(mb_strlen($this->name) > 100) throw new Exception('ERROR: your NAME is longer than 100 symbols');
вопрос, как можно подобное реализовать на python?
о есть, я прикинул так:
if os.path.exists('users/' + str(self.uid) + '.txt'): try: #а что тут? except: return 'ERROR: file with ' + str(self.uid) + ' id is already exists' elif self.balance < 0: try: #а что тут? except: return 'ERROR: your BALANCE is less than 0'