Given an array of integers, every element appears three times
except for one. Find that single one.
题意:有一个数组,只有一个数出现一次,其他的都出现三次,找出一次的数
思路:首先我们想到是每次把每一位二进制上1的个数都mod3,然后就能找出一个的了,但是这样空间太大了,所以我们想能记录...
分类:
其他好文 时间:
2015-02-13 22:31:19
阅读次数:
279
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
分类:
其他好文 时间:
2015-02-13 10:12:28
阅读次数:
235
找到robot/utils/unic.py,修改_unic函数def _unic(item, *args): try: return unicode(item, *args) except UnicodeError: try: retur...
分类:
其他好文 时间:
2015-02-11 23:19:24
阅读次数:
205
异常是Python对象,表示一个错误。所有异常都是基类Exception的成员。所有异常都从基类Exception继承,而且都在exceptions模块中定义。与异常相关的关键字:raise:手动跑出/引发异常try/except:捕获异常并处理pass:忽略异常as:定义异常实例(exceptIOErrorase)finally:无..
分类:
编程语言 时间:
2015-02-10 02:04:47
阅读次数:
245
代码贴出来学习一下
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the Lic...
分类:
其他好文 时间:
2015-02-08 15:28:15
阅读次数:
1442
挺信手拈来的
def gettitle( url ):
try:
_ = re.search('(.*?)', requests.get(url).content)
print url, _.group(1)
except:
pass...
分类:
编程语言 时间:
2015-02-07 06:54:21
阅读次数:
205
# -*- coding: utf-8 -*-import osimport sysimport stringnewline, s = ("", "")try: f = open(u"简易记账.csv")except IOError: print "文件不存在!".decode('utf8').en...
分类:
其他好文 时间:
2015-02-06 18:19:17
阅读次数:
197
一.错误处理
1. 使用try .. exception .. finally
try:
print 'try...'
r = 10 / 0
print 'result:', r # 出现异常不会打印这句话
except ZeroDivisionError, e: # 如果有异常就会被捕获到
print 'except:', e
else:...
分类:
编程语言 时间:
2015-02-04 21:49:20
阅读次数:
258
python能够改变变量作用域的代码段是def(函数)、class(类)、lamda.if/elif/else、try/except/finally、for/while 并不能涉及变量作用域的更改,也就是说他们的代码块中的变量,在外部也是可以访问的,这点与有{}标注界限的其他类型语言不通。特别注意。...
分类:
编程语言 时间:
2015-02-02 13:55:29
阅读次数:
188
XPS Project FilesXilinx® EDK has several project file types. Except where otherwise noted, you can edit these files according to your design needs.Pro...
分类:
其他好文 时间:
2015-01-31 17:46:44
阅读次数:
199