Skip to content

Commit 39d7d08

Browse files
committed
先去吃饭=w=
1 parent a3301ef commit 39d7d08

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

NKUCodingCat/0024/main.py

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#coding=utf-8
2+
const = """
3+
<!DOCTYPE html>
4+
<html lang="zh-cn">
5+
<head>
6+
<meta charset="utf-8">
7+
<style type="text/css">
8+
h1
9+
{
10+
color: green;
11+
}
12+
table, th, td
13+
{
14+
border: 1px solid blue;
15+
}
16+
table
17+
{
18+
border-collapse: collapse;
19+
width: 100%;
20+
}
21+
th
22+
{
23+
height: 50px;
24+
}
25+
td.task
26+
{
27+
width: 70%;
28+
}
29+
input#delete
30+
{
31+
font-size: 15px;
32+
color: blue;
33+
background-color: #FFFFFF;
34+
border-width: 0;
35+
cursor: pointer;
36+
}
37+
textarea
38+
{
39+
vertical-align: middle;
40+
width: 500px;
41+
height: 100px;
42+
}
43+
input#submit
44+
{
45+
width: 107px;
46+
height: 42px;
47+
border-width: 0;
48+
font-size: 17px;
49+
font-weight: 500;
50+
border-radius: 6px;
51+
cursor: pointer;
52+
}
53+
</style>
54+
</head>
55+
56+
<body>
57+
<h1>TodoList应用演示</h1>
58+
59+
<form action="" method="post">
60+
61+
<table>
62+
<tr>
63+
<td class="task_h"><div align="center">任务</div></td>
64+
<td class="manage_h"><div align="center">管理</div></td>
65+
</tr>
66+
<tr>
67+
<td class="task">{{ task.task }}</td>
68+
<td class="manage">
69+
<div align="center">
70+
<input type="submit" name="id-1" id="delete" value="删除" />
71+
</div></td>
72+
</tr>
73+
<tr>
74+
<td class="task">{{ task.task }}</td>
75+
<td class="manage">
76+
<div align="center">
77+
<input type="submit" name="id-2" id="delete" value="删除" />
78+
</div></td>
79+
</tr>
80+
</table>
81+
<br>
82+
<textarea name="newtask" id="newtask" maxlength="500"></textarea>
83+
<input type="submit" name="new" id="submit" value="创建新任务" />
84+
</form>
85+
86+
87+
</body>
88+
</html>
89+
"""
90+
91+
92+
from bottle import static_file,route, run, post, request, redirect
93+
import os, urllib,re,json,time
94+
Root = os.path.split(os.path.realpath(__file__))[0]+"/static/"
95+
96+
97+
@route('/todo')
98+
def index():
99+
return const
100+
@post('/todo')
101+
def Accept():
102+
Req = request.body.read()
103+
L = re.split("&",Req)
104+
M = {}
105+
for i in L:
106+
A = re.split("=",i)
107+
M[A[0]] = urllib.unquote(A[1])
108+
return json.dumps(M)
109+
run(host='localhost',port=8080)

0 commit comments

Comments
 (0)