1. with-as (context-manager)
with function() as instance:
#do something
Codes above do the following:
Let instance = function(), where function returns an instantiation of some object, and this object has defined method __enter__() and __exit__().
In addition, before do something, execute __enter__(),
and after do something, execute __exit__() which are defined in the class of instance.
For detail, see http://blog.csdn.net/suwei19870312/article/details/23258495
2. basic data type manipulation
example:
[1] + [2] -> [1, 2]
[1] * 3 = [1, 1, 1] (or written as [1 for _ in range(3)])
#to be supplemented
原文:http://www.cnblogs.com/mjust/p/5831554.html