diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b6b1ecf --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 已忽略包含查询文件的默认文件夹 +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..3570188 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d21735e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/myPythonWebHomework.iml b/.idea/myPythonWebHomework.iml new file mode 100644 index 0000000..c03f621 --- /dev/null +++ b/.idea/myPythonWebHomework.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/2026-04-07/2026-04-07_hw_1.py b/2026-04-07/2026-04-07_hw_1.py new file mode 100644 index 0000000..ba562d7 --- /dev/null +++ b/2026-04-07/2026-04-07_hw_1.py @@ -0,0 +1,16 @@ +from flask import Flask + + +app = Flask(__name__) + +@app.route("/liuhz1/") +def lhz(): + return "哇! 你找到lhz啦! " + +app.add_url_rule(rule = "/liuhz2/", view_func= lhz) + +def main(): + app.run() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/2026-04-07/24计应1_杨近澜_1113_2026-04-07作业.docx b/2026-04-07/24计应1_杨近澜_1113_2026-04-07作业.docx new file mode 100644 index 0000000..d9d479c Binary files /dev/null and b/2026-04-07/24计应1_杨近澜_1113_2026-04-07作业.docx differ diff --git a/2026-04-07/main.py b/2026-04-07/main.py new file mode 100644 index 0000000..8d1b776 --- /dev/null +++ b/2026-04-07/main.py @@ -0,0 +1,36 @@ +from flask import Flask +from werkzeug.routing import BaseConverter + + +app = Flask(__name__) +@app.route("/") +def hello_flask(): + return "

Hello, Flask!

" + +@app.route("/index/") +def index(): + return "

这是首页!

" + +@app.route("/api/lhz/") +def lhz(): + return """
这是LiuHanZheng
+
Length: 1cm
""" + +app.add_url_rule(rule='/lhz/', view_func=lhz) + +@app.route("/pages//") +def page_num(page): + return f"
当前为第{page}页
" + + +class MobileConverter(BaseConverter): # 自定义转换器 + regex = "1[3-9]\d{9}$" # 定义匹配手机号码的规则 +app.url_map.converters["mobile"] = MobileConverter # 添加到转换器字典 + +@app.route("/user//") +def mobile_index(mobile): + return f'手机号为:{mobile}' + + +if __name__ == "__main__": + app.run(port=1145) \ No newline at end of file diff --git a/2026-04-07/requirements.txt b/2026-04-07/requirements.txt new file mode 100644 index 0000000..ff15c7f Binary files /dev/null and b/2026-04-07/requirements.txt differ