0

Say I have some string in a python file like:

myString = "Hello StackOverflow"

How I could access and use it in a separate html file like this generic template:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>

1 Answer 1

1

You really should use one of the many existing template libraries (Jinja being one of the most popular).

You can simply read in your template as a string and .format() it like any other, but this is error prone and you will run into many difficulties.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.