上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 65 下一页
摘要: 没有使用类时 # 练习基本语法 求班级中小于3岁孩子的男生是 女生是 def get_m(students, minage=3): # 男生的列表 malelist = [] # 遍历全部的学生 for student in students: # 筛选出小于3岁的孩子 if student['ag 阅读全文
posted @ 2023-08-16 14:45 胖豆芽 阅读(3) 评论(0) 推荐(0) 编辑
摘要: numbers = [4, 2, 1, 3, 5] numbers.sort() print(numbers) # 输出: [1, 2, 3, 4, 5] 阅读全文
posted @ 2023-08-14 16:51 胖豆芽 阅读(5) 评论(0) 推荐(0) 编辑
摘要: def example_func(**kwargs): for key, value in kwargs.items(): print(f"{key}: {value}") example_func(name="Alice", age=25, city="New York") 阅读全文
posted @ 2023-08-14 16:33 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
摘要: # 导入正则表达式 import re # 参数2 str1 = "<html>a='as1d32as1d654as54d65asd465asd4'</html>" # 参数1 pattern = r"<html>a=(.*?)</html>" # 调用re中的寻找方法search result = 阅读全文
posted @ 2023-08-14 16:31 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要: with open("file.txt", "r") as file: lines = file.readlines() print(lines) # ['Line 1\n', 'Line 2\n', 'Line 3\n'] with open("file.txt", "r") as file: c 阅读全文
posted @ 2023-08-14 15:55 胖豆芽 阅读(41) 评论(0) 推荐(0) 编辑
摘要: alist1=["apple","banana","orange"] alist2=["pear","peach","watermelon"] alist1.append(alist2) print(alist1) ''' ['apple', 'banana', 'orange', ['pear', 阅读全文
posted @ 2023-08-14 15:46 胖豆芽 阅读(54) 评论(0) 推荐(0) 编辑
摘要: str1 = 'agcadssadjkl' one=str1.index('a',) t=str1.index('a',one+1) s=str1.index('a',t+1) print(one) print(t) print(s) ''' 037 ''' 阅读全文
posted @ 2023-08-14 15:30 胖豆芽 阅读(11) 评论(0) 推荐(0) 编辑
摘要: import inspect def func1(): caller = inspect.stack()[1].function ''' stack 堆栈;[0] 是自己所在的方法; [1]是被调用的方法 ''' print(f"func1方法被{caller}方法调用了") def func2() 阅读全文
posted @ 2023-08-14 14:44 胖豆芽 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 项目工程格式如下 1.写一个flask功能 app/app.py from flask import Flask app = Flask(__name__) @app.route("/index") def index(): return "Hello World!" if __name__ == 阅读全文
posted @ 2023-08-11 20:20 胖豆芽 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1. 新建一个flask工程文件 2. 将工程文件,打包成一个txt 文件 pip freeze >req.txt 未完待续 阅读全文
posted @ 2023-08-10 17:32 胖豆芽 阅读(8) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 65 下一页