2024-10-02 20:35:08 发布
网友
reqUser = friends.UserFriends.gql("where udid =:1", str(udid) ).get() reqUserName = reqUser.userName
这是我的代码,我想知道如何处理这个错误,这个错误出现在第2行
你可以使用pythons try/except pair。在
reqUser = friends.UserFriends.gql("where udid =:1", str(udid) ).get() try: reqUserName = reqUser.userName except AttributeError: reqUserName = "No username found!"
这只捕获AttributeError异常,因此仍将引发任何其他异常。在
你可以使用pythons try/except pair。在
这只捕获AttributeError异常,因此仍将引发任何其他异常。在
相关问题 更多 >
编程相关推荐