forked from miczar1/djfz-24_25
D5 changes, checker added
This commit is contained in:
parent
077f7fa966
commit
8c0af38006
@ -23,6 +23,6 @@ with open('polish_wiki_excerpt.in', encoding='utf8') as file:
|
||||
print(line)
|
||||
final.append(line)
|
||||
|
||||
# with open('polish_wiki_excerpt.out', 'w', encoding='utf8') as file:
|
||||
# for line in final:
|
||||
# file.write(line + '\n')
|
||||
with open('polish_wiki_excerpt.out', 'w', encoding='utf8') as file:
|
||||
for line in final:
|
||||
file.write(line + '\n')
|
@ -13,7 +13,7 @@ with open('simple.in', encoding='utf8') as file:
|
||||
prefix = match.group(1)
|
||||
word_to_replace = match.group(0)[len(prefix):len(match.group(0))]
|
||||
replacement = 'x' * len(word_to_replace)
|
||||
return f"{prefix}{replacement}"
|
||||
return prefix + replacement
|
||||
|
||||
line = re.sub(pattern, replace_third_word, line)
|
||||
print(line)
|
||||
|
16
checker.py
Normal file
16
checker.py
Normal file
@ -0,0 +1,16 @@
|
||||
with open("./TaskD01/polish_wiki_excerpt.out", 'r', encoding='utf8') as f:
|
||||
lines1 = f.readlines()
|
||||
|
||||
with open("./TaskD01/polish_wiki_excerpt.exp", 'r', encoding='utf8') as f:
|
||||
lines2 = f.readlines()
|
||||
|
||||
i = 1
|
||||
for line1, line2 in zip(lines1, lines2):
|
||||
if line1.strip() == line2.strip():
|
||||
pass
|
||||
# print('hurray')
|
||||
else:
|
||||
print(f'{i}: bad')
|
||||
i += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user