In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly talks about "what is the control structure of python script framework webpy template". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn the "python script framework webpy template control structure" bar!
The control structure is for,while,if-else,if-elif,while. Else, in fact, in web.py as we have learned before, the operation is basically the same, but there are still some differences!
For$for row in range (10): line $row $def with (funs) $for row in funs:
Line $row
Be sure to remember here that funs do not add $
If funs is list, then some properties of $ros specific list, which you can see in while
While$while funs: $funs.pop ()
Funs is list, specific pop attribute
If-else$for row in range (10): $if row==2: I am 2$ elif row==3: I am 3$ else: $row instance
Content in index.html
$def with (fun_name Funs) web parameter template my name: use of the range function $for row in range (10): line $row my name: $fun_name $# comment $for row in funs: line $row my name: while loop $while funs: $funs.pop () my name: if-else $for row in range (10): $if row==2: I am 2$ elif row==4: I am 4$ else: $row
What is in the Python:
# coding:utf-8 import web urls= ('/', 'Index',) render = web.template.render (' html/') class Index: def funA (self): mylist= ['1', 2', 5'] return mylist def GET (self): web.header ('Content-Type','text/html) Charset=UTF-8') return render.myindex ('for cycle', (1) app=web.application (urls,globals ()) if _ _ name__ = ='_ main__': app.run ()
Results:
At this point, I believe you have a deeper understanding of the "python script framework webpy template control structure". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.