README / Telegram_Job_Bot /inject.py
nmnm969989's picture
Upload 550 files
ece3e8e verified
Raw History Blame Contribute Delete
430 Bytes
import re
with open('main.py', 'r', encoding='utf-8') as f:
content = f.read()
with open('top5_v3.html', 'r', encoding='utf-8') as f:
new_html = f.read()
pattern = re.compile(r' return f\"\"\"<!DOCTYPE html>.*?</html>\"\"\"', re.DOTALL)
new_content = pattern.sub(' return f\"\"\"' + new_html + '\"\"\"', content)
with open('main.py', 'w', encoding='utf-8') as f:
f.write(new_content)
print("Replaced!")