+ -
当前位置:首页 → 问答吧 → sys.path.expanduser('~/python') 不可用

sys.path.expanduser('~/python') 不可用

时间:2011-07-21

来源:互联网

reduce(function, iterable[, initializer])
Apply function of two arguments cumulatively to the items of iterable, from left to right, so as to reduce the iterable to a single value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates ((((1+2)+3)+4)+5). The left argument, x, is the accumulated value and the right argument, y, is the update value from the iterable. If the optional initializer is present, it is placed before the items of the iterable in the calculation, and serves as a default when the iterable is empty. If initializer is not given and iterable contains only one item, the first item is returned.

上面是官方网站上的

其中
If the optional initializer is present, it is placed before the items of the iterable in the calculation, and serves as a default when the iterable is empty. If initializer is not given and iterable contains only one item, the first item is returned.
这句话 不太理解,,能否举个例子说明下....
谢谢了..

作者: bellszhu   发布时间: 2011-07-21

热门下载

更多