一,语句1.赋值语句2.调用语句3.print,打印对象4.条件判断:if/elif/else5.序列迭代:for/else6.普通循环:while/else7.pass:占位符8.break9.continue10.def11.return12.yield13.global:命名空间14.raise:触发异常15.import16.from:模块属性访问17.class:类18.try/except..
分类:
编程语言 时间:
2015-10-28 19:37:01
阅读次数:
219
Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv...
分类:
其他好文 时间:
2015-10-27 06:58:09
阅读次数:
144
python 内置了一套try...except...finally...的错误处理机制; try:
print ‘try‘
r = 10 / 0
print ‘result:‘, r
except ZeroDivisionError, e:
print ‘except:‘, e
finally:
print ‘final...
分类:
编程语言 时间:
2015-10-26 17:08:27
阅读次数:
195
Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except...
分类:
其他好文 时间:
2015-10-25 16:11:08
阅读次数:
190
python能够改变变量作用域的代码段有:lamaba、def、class if/elif/else、for/while、try/except/finally不能改变变量的作用域范围,在这些代码段中的变量,外部也能访问; 变量的访问路径: local:比如functio...
分类:
编程语言 时间:
2015-10-22 12:41:40
阅读次数:
276
Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv...
分类:
其他好文 时间:
2015-10-22 06:46:28
阅读次数:
124
1 # -*- coding: utf-8 -*- 2 3 from PyQt4 import QtCore, QtGui 4 5 try: 6 _fromUtf8 = QtCore.QString.fromUtf8 7 except AttributeError: 8 def...
分类:
其他好文 时间:
2015-10-21 01:43:45
阅读次数:
262
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 is1 -> 2 -> 3 -> ...
分类:
其他好文 时间:
2015-10-18 11:17:24
阅读次数:
118
泻药,OS X El Capitan中,在内核下引入了Rootless机制,以下路径: /System /bin /sbin /usr (except /usr/local) 均属于Rootless范围,即使root用户无法对此目录有写和执行权限,只有Apple以及Apple授权签名的软...
分类:
系统相关 时间:
2015-10-16 15:35:00
阅读次数:
185
原题链接在这里:https://leetcode.com/problems/product-of-array-except-self/看到这道题内心十分憎恨自己,这道题在Amazon电面中遇到,当时没有刷题,没有想到这种方法,若是当时刷了题该多好。leftArr rightArr的方法早已知晓。fo...
分类:
其他好文 时间:
2015-10-15 06:23:50
阅读次数:
228