Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

import re handle = open('regex_sum_330187.txt') for line in handle : line = line.rstrip() numbers = re.findall('([0-9]+)',line) print(sum(numbers))

Nutty Newt answered on March 19, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • is there find_all method in re or regex module in python?
  • Python RegEx Findall – re.findall()
  • Use regex to extract row in R (problem)
  • Use regex to extract row in R (solution 1)
  • Use regex to extract row in R (solution 2)
  • import re #your code goes here number=input() pattern=r"(1|8|9)[0-9]+" match=re.match(pattern,number) of lane(number)==8: if(match): print("value") else: print("invalid") else print("invalid")
  • reg ex code to find and add number value only

  • import re handle = open('regex_sum_330187.txt') for line in handle : line = line.rstrip() numbers = re.findall('([0-9]+)',line) print(sum(numbers))

    0
    Popularity 1/10 Helpfulness 1/10 Language python
    Link to this answer
    Share Copy Link
    Contributed on Mar 19 2023
    Nutty Newt
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.