摘要: def found_number(need_vaule,l): print(l) mid_index=len(l) // 2 mid_value=l[mid_index] print("mid_value is %s"%(mid_value)) if mid_value > need_vaule: 阅读全文
posted @ 2024-04-19 19:06 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: def deco1(func1): def wrapper1(*args,**kwargs): print("运行deco1_wrapper1") res1=func1(*args,**kwargs) return res1 return wrapper1 def deco2(func2): def 阅读全文
posted @ 2024-04-18 15:16 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: '''传参方式1''' def get(url): response=requests.get(url) print(response.text) get("https://www.cnblogs.com/clairedandan/p/?page=1") '''传参数方式2''' # def out 阅读全文
posted @ 2024-04-16 22:06 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 问题:在Pycharm 中报requests module 找不到 特别的地方:已经通过“pip3 install requests” 的命令安装过requests这个模块,并能顺利运行,但是不能在Pycharm 中运行 解决方案如下: 1. 找到Pycharm 中的setting设置,并打开 2. 阅读全文
posted @ 2024-04-16 21:54 正霜霜儿 阅读(2) 评论(0) 推荐(0) 编辑
摘要: '''函数的参数实际上是实际参数传给形式参数的过程 通用性更强 ,可以理解为一个模版''' # def add(a,b): #a,b 是形参 # print(a+b) # add(2,3) #传递参数 '''1. 必选参数,定义了几个,就必须传几个''' # def funb(a,b): # res 阅读全文
posted @ 2024-04-16 17:43 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: ''' 1. 什么是文件: 文件是操作 系统给用户/应用程序操作硬盘的一种虚拟的概念/接口 用户/应用程序 操作系统(文件) 计算机硬件(硬盘) 2. 为何要用文件 用户/应用程序可以通过文件将数据永久保存的硬盘中,即操作文件就是操作硬盘 用户/应用程序直接操作的是文件,对文件进行的所有的操作都是在 阅读全文
posted @ 2024-04-15 19:52 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: '''函数:把具有独立功能的代码块组合成一个个小模块 作用:提高代码的效率,实现代码重复 流程标准化 # 可以在不同的地方多次调用,想要使用几次就使用几次,更加灵活,只需要调用,不需要重新定义''' # def 函数名(): # 函数的定义 #函数名需要复合标志符的命名规范(必须是字母,下划线,数字 阅读全文
posted @ 2024-04-15 14:25 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #深复制(拷贝) ''' import copy a=[1,2,3,[4,5,6]] #深拷贝 a_deepcopy=copy.deepcopy(a) print(id(a)) #140399549872448 print(id(a_deepcopy)) #140399549873280 a[2]= 阅读全文
posted @ 2024-04-15 12:58 正霜霜儿 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 子查询 由一个具体的需求,引入子查询 谁的工资比Abel 的高 SELECT * from employees WHERE salary > ( SELECT salary FROM employees WHERE last_name = 'Abel' ) -- 自连接 SELECT e2.* FR 阅读全文
posted @ 2024-04-12 18:02 正霜霜儿 阅读(1) 评论(0) 推荐(0) 编辑
摘要: '''函数函 input() 的工作原理 的函数input() 让程序暂停运行,等待用户输入一些文本。获取用户输入后,Python将其存储在一个变量中,以方便你使用。'''# message = input("please tell me your name: ")# print("hello "+ 阅读全文
posted @ 2024-04-12 18:00 正霜霜儿 阅读(2) 评论(0) 推荐(0) 编辑