
1
shakespaces 2015 年 12 月 22 日
拼写不忍直视
|
2
mengzhuo 2015 年 12 月 22 日
天啊……楼主你还是回去看看书吧
不……不是那本 Python 手册,我说的是英语书! |
3
Arthur2e5 2015 年 12 月 22 日 ……你想不想知道有個內置函式叫做 sum(*iterable)?
|
5
stillwater 2015 年 12 月 22 日
转换成 float 再相加吧
|
6
ericls 2015 年 12 月 23 日
@shakespaces 估计是手滑 uy 在 yt 旁边
|
7
latyas 2015 年 12 月 23 日 让 lz 难受一下
sum(map(lambda item: float(re.findall('[\d\.]+', item)[0]), map(lambda x: x.text, i.select['.price_n']))) @Arthur2e5 是 sum(iterable) sum(iterable, start=0, /) Return the sum of a 'start' value (default: 0) plus an iterable of numbers When the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types. |