Hi so I'm decrypting information so the value return is coming back as a byte. I'm trying to print it as a str so I can get rid of the b'' format. But I can't figure out how to do it in html template
{% for row in rows %}
{{ repr(password.decrypt(row['text']))[2:-1] }}
{% endfor %}
This is the code I tried, but I get repr not define. I'm trying to use python built in function repr in my html file
{% for row in rows %}
{{ password.decrypt(row['text'])[2:-1]|string }}
{% endfor %}
and pass the decrypt()
function by retrun render_template("index.html", decrypt=decrypt)
into your jinja template.
However, the jinja
template will still go through your flask route
to render as a real html
before sending it to frontend. So I don't think there is difficulty in moving the function into py
file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.