On 3 Sep 2023, at 18:10, Jan Erik Moström via Python-list wrote:
> I'm looking for some advice for how to write this in a clean way
Thanks for all the suggestion, I realize that I haven't written Python code in
a while. I should have remembered this myself !!! Thanks for reminding me.
= jem
--
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
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
On 9/3/2023 12:10 PM, Jan Erik Moström via Python-list wrote:
I'm looking for some advice for how to write this in a clean way
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
On 3 Sep 2023, at 19:13, MRAB via Python-list wrote:
> You could use pass an anonymous function (a lambda) to re.sub:
Of course !! Thanks.
= jem
--
https://mail.python.org/mailman/listinfo/python-list
On 2023-09-03 17:10, Jan Erik Moström via Python-list wrote:
I'm looking for some advice for how to write this in a clean way
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