class DiNothing(Skill):
# this skill does absolutely nothing
def __init__(self):
super().__init__()
class AHReequip(Skill):
# equips a skill as needed
def __init__(self, brain:Brain):
super().__init__()
self.set_skill_type(2)
self.brain = brain...
class DiNothing(Skill):
# this skill does absolutely nothing
def __init__(self):
super().__init__()
class AHReequip(Skill):
# equips a skill as needed
def __init__(self, brain:Brain):
super().__init__()
self.set_skill_type(2)
self.brain = brain...
import re
def make_extractor(pattern_str):
# Escape the whole string so regex metacharacters donβt break it
escaped = re.escape(pattern_str)
# Replace the escaped 'fudge' with a capture group
regex_str = escaped.replace(r"fudge", r"(.*)")
return re.compile(regex_str)
s =...
v2:
import re
text = "code xx yy ok zz"
# Strict fullβstructure match
v1, v2 = re.fullmatch(r"code\s+(.*?)\s+ok\s+(.*)", text).groups()
print(v1) # xx yy
print(v2) # zz