0

我的代码:

try:
    self.cookie = Cookie.SimpleCookie(os.environ["HTTP_COOKIE"])
    tmpuid = self.cookie["uid"].value
    tmpsid = self.cookie["sid"].value
except Exception as e:
    if not str(e).startswith('No cookie set'):
        import traceback
        traceback.print_exc()
    return False

“traceback.print_exc()”之后是否需要“return False”?

4

1 回答 1

1

当然,异常只在No cookie set异常上停止。如果是任何其他异常,程序将return False而不是继续下一条语句

于 2013-01-06T01:49:48.633 回答