1
0
Fork 0

Upload files to "script"

This commit is contained in:
TED A. ⭕ 2023-11-12 21:48:14 +00:00
parent 704b714266
commit a7e6639e70
1 changed files with 26 additions and 0 deletions

26
script/html.py Normal file
View File

@ -0,0 +1,26 @@
# gpt
# Define the list of colors
colors = ["#f1672b", "#fea419", "#efd515", "#89d842", "#35c2f9", "#9b5fe0", "#ff68cf"]
# Read the input HTML file
with open("input.html", "r") as file:
lines = file.readlines()
# Open a new file to write the modified HTML content
with open("output.html", "w") as file:
# Iterate through the lines and modify them with sequential colors
for index, line in enumerate(lines):
# Extract user ID and username
user_id_start = line.find('/users/') + len('/users/')
user_id_end = line.find('">', user_id_start)
user_id = line[user_id_start:user_id_end]
username_start = line.find('@', user_id_end) + 1
username_end = line.find('</a>', username_start)
username = line[username_start:username_end]
# Construct the modified line
modified_line = f'<span class="rainbow">❤ </span><a href="https://sketchersunited.org/users/{user_id}" style="color: {colors[index % len(colors)]};">@{username}</a><br>\n'
# Write the modified line to the output file
file.write(modified_line)
print("HTML file successfully processed and saved as output.html")