time
=
datetime
.
date
.
today
(
)
name
=
[
"l1"
,
"l2"
,
"l3"
]
task
=
{
"task"
:
"clean"
,
"time"
:
"3hour"
,
"ouu"
:
"ou2"
}
return
render_template
(
"index.html"
,
var
=
time
,
list
=
name
,
task
=
task
)
#表单提交
# ↓这个是网页的路径
@app
.
route
(
'/test/rigister'
)
def
register
(
)
:
# ↓这个是左边目录的文件结构
return
render_template
(
(
"test/register.html"
)
)
#接收表单必须有一个methods,需要指定methos为post
@app
.
route
(
'/result'
,
methods
=
[
'POST'
,
'GET'
]
)
def
result
(
)
:
if
request
.
method
==
'POST'
:
result
=
request
.
form
return
render_template
(
"test/result.html"
,
result
=
result
)
#Flask应用程序实例的run方法启动WEB服务器
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Title</title>
</head>
today is {{var}} hello ouou.
you:<br/>
{% for data in list %}
<li>{{data}}</li>
{% endfor %}
task:<br/>
<table border="1">
{% for key,value in task.items() %}
<td>{{key}}</td>
<td>{{value}}</td>
{% endfor %}
</table>
</body>
</html>
result.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Title</title>
</head>
<table border="1">
{% for key,value in result.items() %}
<th>{{key}}</th>
<td>{{value}}</td>
{% endfor %}
</table>
</body>
</html>
register.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Title</title>
</head>
<form action="{{url_for('result')}}" method="post">
<p>姓名: <input type="text" name="姓名"></p>
<p>年龄: <input type="text" name="年龄"></p>
<p>性别: <input type="text" name="性别"></p>
<p>地址: <input type="text" name="地址"></p>
<p><input type="submit" value = "提交"></p>
</form>
</body>
</html>
java 继承 返回对象 java继承简单例子
1.什么是继承继承就是子类继承父类的特征和行为,使得子类对象(实例)具有父类的实例域和方法,或子类从父类继承方法,使得子类具有父类相同的行为。继承格式:简单例子:创建父类(Animal):public class Animal {
public String name;
public int age;
public void doing(){
java ocr方式识别 java实现文字识别
背景:公司项目需要上传省份证,营业执照等图片,需要获取里面的信息。所以使用了百度文字识别,方便快捷 主要是免费的,虽然一天是有限数的;本来百度上的API文档很清楚了,但是现在还是稍微了的整理下。首先添加一个百度的jar包<!-- https://mvnrepository.com/artifact/com.baidu.aip/java-sdk -->
<depen