Answer the question
In order to leave comments, you need to log in
How to translate a string in html flask?
Let's say there are two pages. The first, static, contains a form that is designed to write html files to the database. Here is how the file is processed:
def OneFile(path):
with io.open(path, 'r') as f:
content = f.read()
soup = bs(content, features='lxml')
content = str(soup.find('body'))[6:-7]
images = soup.find_all('img')
if images != []:
images = list(map(str, list(images)))
for i in images:
img = bs(i, features='lxml').find('body').find('img')
src = img.get('src')
src2 = f"{{{{ url_for('static' filename='{str(src)}') }}}}"
img2 = str(img).replace(str(src), str(src2))
content = content.replace(str(img), img2)
return content
<h1></h1>
. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question