Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

String not printing after regular expression match  RSS feed

Posts: 2
  • 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: 17
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.

Get me the mayor's office! I need to tell him about this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!