How to make web element generation simpler in python-Python tutorial
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Web is not simple, especially when you need some web effects, such as displaying a rounded rectangle or prompt box, you may think it is very simple. let's analyze it: 1. reference css. This is probably the most common practice. it defines a specific style for some specific elements. To use it, you need
3. HTML elements. You need to set some special attributes, such as class = A certain attribute. This is relatively simple.
Therefore, from the analysis above, we can see that adding a nice web element may be modified in many places. Therefore, I
I am thinking about how to simplify this process. The trouble is how to deal with these resources and how to make these resources
What about the combination of HTML? The final solution I came up with was code assembly.
So how to define the web element class and how to process it in the template?
A web element class is defined as follows:
Class Snippet (object ):
Def render (self ):
Def _ str _ (self ):
Return self. render ()
If it is defined as a class property, it will be output to the HTML header, and the result of render () will be displayed in the place where the class is called in the template. First take a look at the template
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.