其他相关 1、isinstance(obj,cls) 检查是否obj是类cls的对象 2、issubclass(sub,super) 检查sub类是否是super类的派生类 3、异常处理 1:模式: try: # 正常的代码 pass except Exception,e: # 异常后显示的内容 p ...
分类:
编程语言 时间:
2016-06-08 15:26:59
阅读次数:
155
可以通过try/except语句来实现捕获异常,如下: 捕获异常: 这里只输出提示信息: 结果: 不加参数,捕获异常: 如果捕获到异常,不处理,只传递异常,可以调用不带参数的raise,如下事例: 传递异常: 不传递异常 除0行为发生,屏蔽被打开,calc会返回None。 ...
分类:
编程语言 时间:
2016-05-30 14:10:09
阅读次数:
215
#coding:utf-8__author__ = 'hdfs'try: name=['9','7'] name[3] 1/0except IndexError,e: print(e)except Exception,e: print(e)finally: print('End...>>>')cla ...
分类:
编程语言 时间:
2016-05-29 10:57:29
阅读次数:
184
Problem: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> ...
分类:
其他好文 时间:
2016-05-28 01:19:11
阅读次数:
191
doOnNext官方介绍:
The doOnNext operator is much like doOnEach(Action1) except that the Action that you pass it as a parameter does not accept a Notification but instead simply accepts the emitted item.
可...
分类:
编程语言 时间:
2016-05-27 12:11:50
阅读次数:
289
Delete Node in a Linked List
Total Accepted: 83091 Total
Submissions: 189238 Difficulty: Easy
Write a function to delete a node (except the tail) in a singly linked list, giv...
分类:
其他好文 时间:
2016-05-27 11:32:21
阅读次数:
153
Problem Description
Ignatius is building an Online Judge, now he has worked out all the problems except the Judge System. The system has to read data from correct output file and user’s result file, t...
分类:
其他好文 时间:
2016-05-26 06:22:46
阅读次数:
292
1.raw_input的使用 从键盘读取信息,返回字符串。 例: hrs = raw_input("Enter Hours:")pay=raw_input("Enter Pay:")print float(hrs)*float(pay) 2.try: except: 类似c中的try throw c ...
分类:
编程语言 时间:
2016-05-25 22:28:57
阅读次数:
171
defmain():
globallisten
globalport
globalexecute
globalcommand
globalupload_destination
globaltarget
ifnotlen(sys.argv[1:]):
usage()
try:
opts,args=getopt.getopt(sys.argv[1:],"hle:t:p:cu",["help","listen","execute","target","port","command","upload"])
exce..
分类:
编程语言 时间:
2016-05-19 06:48:06
阅读次数:
267