Coursera Python for everybody assignment 11.1/Python Regex.
import rename = input("Enter file: ") hand = open(name, 'r')sums = []for line in hand: line = line.rstrip() line = re.findall('[0-9.]+',line) line = int(line) if line: sums.append(int(match.group(1)))print(sum(sums))
Python for Everybody assignment 11.1 The actual goal is to read a file, look for integers using the re.findall()
looking for a regular expression of [0-9]+
, then converting the extracted strings to integers and finally summing up the integers.
Pycharm is returning:TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'