How to generate a dynamic html as string error f-string: expressions nested too deeply
I am requesting the html content of file by html_text = requests.get('https://buildpro.store/products/jaquar-water-closet-kus-wht-35951').text
after getting this i want to extract the title price and a lot of different things and then fill my html template with the data and save it as text in csv file
<html>
<head>
<title>Free Health Faucet On Jaquar Water Closet KUS-WHT-35951
</title>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Health Faucet On Jaquar Water Closet",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "Get Jaquar Health Faucet Free (Worth Rs.999) On purchase of Jaquar Water Closet KUS-WHT-35951 and get 25% discount Product SKU : KUS-WHT-35951FREEALD-CHR-583 Closet Details: Product Code: KUS-WHT-35951 MRP: 15990 Closet Size: 385*595*385 Brand : Jaquar Closet Series: Kubix Type of Trap: P-Trap Type of Mounting",
"sku": "0446310786",
"mpn": "925872",
"brand": {
"@type": "Brand",
"name": "Jaquar"
},
"review": {
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4",
"bestRating": "5"
},
"author": {
"@type": "Person",
"name": "BuildPro"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.9",
"reviewCount": "989"
},
"offers": {
"@type": "Offer",
"url": "https://buildpro.store/products/jaquar-water-closet-kus-wht-35951",
"priceCurrency": "INR",
"price": "1,119.99",
"priceValidUntil": "2020-11-20",
"itemCondition": "https://schema.org/UsedCondition",
"availability": "https://schema.org/InStock"
}
}
</script>
</head>
<body>
</body>
</html>
The problem i face is that it have that i cant declare string by using docuble quates and neither by triple and double quotes from this answer How do I create a multiline Python string with inline variables? i learn how can i put variables in a multiline string but when i try to put variable it gives error that more string requires i guess that there are more ways to insert variable other than %s that means that also not work i think we can generate dynamic html with the help of django but if i find a way to save it as string instead of rendering as template