1
Fork 0
internship/olaflow/processing/olaflow.py

22 lines
567 B
Python
Raw Normal View History

2022-03-07 11:19:37 +01:00
import re
class OFModel:
def __init__(self, root):
self._root = root
def write_field(self, field, values):
with open(self._root.joinpath("0", field), "r") as aw_file:
aw_raw = aw_file.read()
with open(self._root.joinpath("0", field), "w") as aw_file:
aw_file.write(
re.sub(
r"(?<=\(\n).*?(?=\n\))",
"\n".join(values.astype(str)),
aw_raw,
count=1,
flags=re.S,
)
)