import re
with open('fix_home_block1.html', 'r', encoding='utf-8') as f:
content = f.read()
with open('block1_html.html', 'r', encoding='utf-8') as f:
new_html = f.read()
pattern_hero = re.compile(r'
*
', re.DOTALL)
if pattern_hero.search(content):
content = pattern_hero.sub('
' + new_html + '\n', content, count=1)
with open('tmp_home_updated_block1.html', 'w', encoding='utf-8') as f:
f.write(content)
print("Replaced successfully!")
else:
print("Could not find kmc-hero section")