Re: Passing info to function used in re.sub

2023-09-04 Thread Dieter Maurer via Python-list
Jan Erik Moström wrote at 2023-9-3 18:10 +0200: >I'm looking for some advice for how to write this in a clean way > ... >The "problem" is that I've currently written some code that works but it uses >global variables ... and I don't like global variables. I assume there is a >better way to write

Re: Passing info to function used in re.sub

2023-09-04 Thread Peter J. Holzer via Python-list
On 2023-09-03 18:10:29 +0200, Jan Erik Moström via Python-list wrote: > I want to replace some text using a regex-pattern, but before creating > replacement text I need to some file checking/copying etc. My code > right now look something like this: > > def fix_stuff(m): > # Do various thing