View Single Post
Old 02-21-2025, 05:13 AM   #76
moldy
Enthusiast
moldy began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Oct 2015
Device: Kindle
Quote:
Originally Posted by maxthegold View Post
Slight problem with the code on the previous post, here is the corrected version.

Code:
        # Do it again for capitalised words    
        m, o = regex.subn(rgx.format(key.capitalize()), new_name.capitalize(), m)
        if do_count and o:
            if n == 0:
                data['counters'][key] = 0
            data['total'] += o
            data['counters'][key] = data['counters'].get(key) + o
Rookie error, not used to Python.
Thanks for your input on this maxthegold. Your improvement saves a lot of time when adding entries to my list and now I only have to run the one function.
moldy is offline   Reply With Quote