Need help in refactoring my python script

2009-08-08 Thread n179911
I have a python script which process a file line by line, if the line matches a regex, it calls a function to handle it. My question is is there a better write to refactor my script. The script works, but as it is, i need to keep indent to the right of the editor as I add more and more regex for m

Re: How to address a global variable in a function

2009-08-07 Thread n179911
On Aug 7, 8:29 pm, n179911 wrote: > HI, > > I have a global variable > > // line 8 > tx  = 0 > > and then I have this function (start in line 12): > def handleTranslate(result): >         print line >         txStr, tyStr = result.group(1), result.grou

How to address a global variable in a function

2009-08-07 Thread n179911
HI, I have a global variable // line 8 tx = 0 and then I have this function (start in line 12): def handleTranslate(result): print line txStr, tyStr = result.group(1), result.group(2) print txStr, tyStr tx += int(txStr) ty += int(tyStr) return