Exception

 

非阻塞Connect对于select时应注意问题http://www.cnitblog.com/zouzheng/archive/2010/11/25/71711.html

 

 http://tieba.baidu.com/p/3873931968?pn=2

 ---------------------------

 https://github.com/cocos2d/cocos2d-x/pull/7520/files

 

building apk
Android platform not specified, searching a default one...
Can't find right android-platform for project : "E:\cocos2d\cocos2d-x-3.1.1\test
s\cpp-tests\proj.android". The android-platform should be equal/larger than 20

 

cocos run -p android --ap 20

 

===============分辩率适配========

 

CCSize frameSize = glview->getFrameSize();

CCSize DesignSize = CCSize(1136,640);

 

float widthRate = frameSize.width/DesignSize.width;

float heightRate = frameSize.height/DesignSize.height;

 

if (widthRate > heightRate)

{

glview->setDesignResolutionSize(DesignSize.width,

DesignSize.height*heightRate/widthRate, kResolutionNoBorder);

}

else

{

glview->setDesignResolutionSize(DesignSize.width*widthRate/heightRate, DesignSize.height,

kResolutionNoBorder);

}

 

=============上传图片不了======================

 

android.os.NetworkOnMainThreadException

    <uses-sdk

        android:minSdkVersion="3"

 

        android:targetSdkVersion="8" />

 

====================================

 

 error: obj/local/armeabi/objs/cpufeatures/cpu-features.o

 

log: delete obj/local/armeabi/objs/cpufeatures/*.*

 

================================================

 

cocostudio

 

 http://www.cocoachina.com/bbs/read.php?tid=195955

http://www.cocoachina.com/bbs/read.php?tid=220090

 

 GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.241.214.216' IDENTIFIED BY '';

 

Cocos2d-x 3.3卡牌设计02:卡牌翻转

http://cn.cocos2d-x.org/tutorial/show?id=2889

### Exception类介绍 在 Python 中,`Exception` 类是所有内置异常类的基类。当开发者需要处理各种异常情况时,`Exception` 类及其子类提供了一种结构化的方式来捕获和处理错误。除了使用 Python 内置的异常类型,开发者还可以自定义异常类型,通常是通过继承 `Exception` 类或者其他现有的异常类来实现。例如: ```python class MyCustomException(Exception): def __init__(self, message): self.message = message ``` 上述代码自定义了一个异常类型 `MyCustomException`,它继承自 `Exception` 类 [^1]。 ### Exception类使用方法 #### 捕获异常 在 Python 中,使用 `try-except` 语句来捕获和处理异常。以下是一个简单的示例,捕获 `ZeroDivisionError` 异常: ```python try: result = 1 / 0 except ZeroDivisionError as e: print(f"捕获到异常: {e}") ``` #### 自定义异常 自定义异常类通常通过继承 `Exception` 类来实现。下面是一个自定义异常类的示例: ```python class MyCustomException(Exception): def __init__(self, message): self.message = message try: raise MyCustomException("这是一个自定义异常") except MyCustomException as e: print(f"捕获到自定义异常: {e.message}") ``` #### 异常信息记录 可以将异常信息记录到文件中,以便后续分析。以下是一个将异常信息写入文件的示例: ```python import traceback try: print("step1") num = 1 / 0 except: with open("d:/a.txt", "a") as f: traceback.print_exc(file=f) ``` 上述代码使用 `traceback` 模块将异常信息写入指定文件 [^2]。 ### 相关知识 在处理异常时,还可以使用 `finally` 子句,无论是否发生异常,`finally` 子句中的代码都会执行。例如: ```python try: result = 1 / 0 except ZeroDivisionError as e: print(f"捕获到异常: {e}") finally: print("无论是否发生异常,这里的代码都会执行") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值