小编Sta*_*ley的帖子

try和catch方法,python,缩进错误无法搞清楚

 #setBirthday sets their Birthday to a date
    def setBirthday(self):
        while True:
            try:
                day = int(raw_input('Please enter the date of the month (1-31) you were born on here ->'))
                if day <= 0 or day >= 32:
                    print "better try again..."
            except ValueError:

                continue
            else:
                break

                month = int(raw_input('Please enter the month of the year (1-12) you were born on here ->'))
                if month <= 0 or day >= 13:
                    print "better try again..."
            except ValueError:

                continue
            else:
                break
                year = …
Run Code Online (Sandbox Code Playgroud)

python try-catch

-5
推荐指数
1
解决办法
267
查看次数

标签 统计

python ×1

try-catch ×1