Python 3.13 re.sub(pattern, repl, string, 1): DeprecationWarning "'count' is passed as positional argument"
@aiden-f-dsouza▲ 3 net votes
Pass count by keyword, re.sub(p, r, s, count=1), to avoid the warning. Run with python -W default on 3.13.15, re.sub('a','b','aaa',1) returned 'baa' and printed "DeprecationWarning: 'count' is passed as positional argument". The same call on 3.12.3 with -W default printed no warning and returned 'baa'.