吐槽:本来挺顺利的,主要就是想记录一下TypeError: 'int' object is not callable怎么解决,顺便记录我代码能改进的地方和哪个课后题的答案~ 嘿嘿,我觉得这种提示我们有更简单解法的题才有意思嘛0.0
题目描述:大概就是从一个文件中提取所有数字并求和。
Finding Numbers in a Haystack
In this assignment you will read through and parse a file with text and numbers. You will extract all the numbers in the file and compute the sum of the numbers.
Data Files
We provide two files for this assignment. One is a sample file where we give you the sum for your testing and the other is the actual data you need to process for the assignment.
- Sample data: http://py4e-data.dr-chuck.net/regex_sum_42.txt (There are 90 values with a sum=445833)
- Actual data: http://py4e-data.dr-chuck.net/re