Last active
July 18, 2024 21:32
-
-
Save Omi98/c6c394f6cf90a4d85456e6c9af98005e to your computer and use it in GitHub Desktop.
A simple Python code to input and generate html escape characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple code in python to generate encoded characters | |
# for your HTML <pre> or <code> block. | |
import html | |
import sys | |
code = sys.stdin.readlines() # Press <ctrl-d> to end input | |
print() | |
print(f"\n\n»»———- Copy the below code & paste it in your html code block ———-««\n") | |
for line in code: | |
line.splitlines() | |
if len(line) != 0: | |
code_modified = line.strip() | |
print(html.escape(code_modified)) | |
print() | |
# Characters include <, >, ", ', and &. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment