18 lines
524 B
Python
18 lines
524 B
Python
with open('/www/wwwroot/gaokao/index.html', 'r') as f:
|
|
content = f.read()
|
|
|
|
# Find the first <style> tag
|
|
first_style = content.index('<style>')
|
|
# Find the last </style> tag
|
|
last_style_end = content.rindex('</style>') + len('</style>')
|
|
|
|
before = content[:first_style]
|
|
after = content[last_style_end:]
|
|
|
|
# Read the new CSS from a separate file (will write separately)
|
|
new_html = before + '<!-- CSS_REPLACEMENT_MARKER -->' + after
|
|
|
|
with open('/www/wwwroot/gaokao/index.html', 'w') as f:
|
|
f.write(new_html)
|
|
print('Marked')
|