История изменений
Исправление Deleted, (текущая версия) :
import re
def subn(string, old, new, pos):
count = 0
def subber(match):
nonlocal count
count += 1
if count == pos:
return new
else:
return old
return re.sub(old, subber, string)
Исходная версия Deleted, :
def subn(string, old, new, pos):
count = 0
def subber(match):
nonlocal count
count += 1
if count == pos:
return new
else:
return old
return re.sub(old, subber, string)