Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

String not printing after regular expression match  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My input is

What I have tried is:

import re

fileName=input("Enter Input File Name: ")
OutName=input("Enter Output File Name: ")

class Calculate:
def freqCal(self,string,freq):
       if (obj.pFreqCount <=3):
           val = float(string)
           res = val + freq
           string =str(res)+"\n"

           obj.pFreqCount = 0
           obj.pFreqFlag = 0
       obj.pFreqCount += 1
def write(self,string):
for line in f1.readlines():    
   if re.match(r'PFREQ1', string):
       obj.pFreqFlag = 1
   elif obj.pFreqFlag == 1:

   elif re.match(r'RDAMP1', string):

Here RDAMP1 is not printing after string search in file. Please help to solve this.Please help me with a code.

Posts: 26
Python VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi itsbinsha, (If I mangled your name, please let me  know.)

Would you re-post your code with the code tags surrounding it please?  I ask because it looks like the indentations of some lines got messed up.  It is not clear what part of the code is part of the class vs. what code is invoking it.

Poop goes in a willow feeder. Wipe with this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!