摘要:
1. Git 创建仓库 git init 把当前目录变成 git 仓库 2. Git 提交更改git add <file> git rm --cached <file> git rm -r --cached <dir> git status 掌握仓库当前的状态 git diff FILE 查看现在文 阅读全文
摘要:
pwd outputs the name of the current working directory.lslists all files and directories in the working directory.cdswitches you into the directory you... 阅读全文
摘要:
unittestTest outcomesTests have 3 possible outcomes:okThe test passes.FAILThe test does not pass, and raises an AssertionError exception.ERRORThe test... 阅读全文
摘要:
包Graphics/ __init__.py plot1d.py Primitive/ __init__.py lines.py fill.py text.py ... Graph... 阅读全文
摘要:
函数参数可以设置缺省值warning:The default value is evaluated only once. This makes a difference when the default is a mutable object such as list, dictionary, or... 阅读全文
摘要:
1. 类属性特殊的类属性C.__name__ 类C的名字(字符串)C.__doc__ 类C的文档字符串C.__bases__ 类C的所有父类构成的元组C.__dict__ 类C的属性C.__module__ 类C定义所在的模块(1.5 版本新增)C.__class__ 实例C... 阅读全文
摘要:
try...except...finallytry 语句块中异常发生点后的剩余语句永远不会到达(所以也永远不会执行). 一旦一个异常被引发, 就必须决定控制流下一步到达的位置. 剩余代码将被忽略, 解释器将搜索处理器, 一旦找到,就开始执行处理器中的代码.如果没有找到合适的处理器, 那么异常就向上移... 阅读全文
摘要:
迭代器根本上说, 迭代器就是有一个 next() 方法的对象迭代器可用内建的iter方法创建>>> i = iter('abc')>>> i.next()'a'>>> i.next()'b'>>> i.next()'c'对类可用__iter__和next()创建迭代器class Fib(object... 阅读全文
摘要:
字典字典的创建>>> a = {'one': 1, 'two': 2, 'three': 3}>>> b = dict(one=1, two=2, three=3)>>> c = dict([('two', 2), ('one', 1), ('three', 3)])>>> a == b == cT... 阅读全文
摘要:
列表 mutable操作符:标准类型操作符都适用序列类型操作符:slice 、in 略+ :>>> lis1 = ['hello']>>> lis2= ['world']>>> lis1 + lis2['hello', 'world']*:>>> lis = ['hello', 'world']>>... 阅读全文