04 2024 档案

摘要: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 正霜霜儿 阅读(13) 评论(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:15 正霜霜儿 阅读(46) 评论(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:05 正霜霜儿 阅读(14) 评论(0) 推荐(0) 编辑
摘要:问题:在Pycharm 中报requests module 找不到 特别的地方:已经通过“pip3 install requests” 的命令安装过requests这个模块,并能顺利运行,但是不能在Pycharm 中运行 解决方案如下: 1. 找到Pycharm 中的setting设置,并打开 2. 阅读全文
posted @ 2024-04-16 21:54 正霜霜儿 阅读(283) 评论(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 正霜霜儿 阅读(11) 评论(0) 推荐(0) 编辑
摘要:''' 1. 什么是文件: 文件是操作 系统给用户/应用程序操作硬盘的一种虚拟的概念/接口 用户/应用程序 操作系统(文件) 计算机硬件(硬盘) 2. 为何要用文件 用户/应用程序可以通过文件将数据永久保存的硬盘中,即操作文件就是操作硬盘 用户/应用程序直接操作的是文件,对文件进行的所有的操作都是在 阅读全文
posted @ 2024-04-15 19:51 正霜霜儿 阅读(10) 评论(0) 推荐(0) 编辑
摘要:'''函数:把具有独立功能的代码块组合成一个个小模块 作用:提高代码的效率,实现代码重复 流程标准化 # 可以在不同的地方多次调用,想要使用几次就使用几次,更加灵活,只需要调用,不需要重新定义''' # def 函数名(): # 函数的定义 #函数名需要复合标志符的命名规范(必须是字母,下划线,数字 阅读全文
posted @ 2024-04-15 14:24 正霜霜儿 阅读(17) 评论(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 正霜霜儿 阅读(24) 评论(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 正霜霜儿 阅读(33) 评论(0) 推荐(0) 编辑
摘要:'''函数函 input() 的工作原理 的函数input() 让程序暂停运行,等待用户输入一些文本。获取用户输入后,Python将其存储在一个变量中,以方便你使用。'''# message = input("please tell me your name: ")# print("hello "+ 阅读全文
posted @ 2024-04-12 18:00 正霜霜儿 阅读(21) 评论(0) 推荐(0) 编辑
摘要:#九九乘法# for i in range(1, 10):# for j in range(1, i+1):# print('{}x{}={}\t'.format(j, i, i*j), end='')# print()row=1while row <= 9: col=1 while col <=r 阅读全文
posted @ 2024-04-12 17:55 正霜霜儿 阅读(15) 评论(0) 推荐(0) 编辑
摘要:# cars = ['audi', 'bmw', 'subaru', 'toyota']# for car in cars:# if car=='bmw':# print(car.upper())# else:# print(car.title())# 一个等号可解读为“将变量car 的值设置为'a 阅读全文
posted @ 2024-04-12 16:11 正霜霜儿 阅读(26) 评论(0) 推荐(0) 编辑
摘要:'''在Python中,字典字 是一系列键—值对值 。每个键 都与一个值相关联,你可以使用键来访问与之相关联的值。 与键相关联的值可以是数字、字符串、列表乃至字典。事实上,可将任何Python对象用作字典中的值。 在Python中,字典用放在花括号{}中的一系列键—值对表示 ''' customer 阅读全文
posted @ 2024-04-12 16:10 正霜霜儿 阅读(26) 评论(0) 推荐(0) 编辑
摘要:聚合函数 1. 常见的聚合函数 1.1 AVG /SUM:只适用于数值类型的字段(或变量) 1.2 MAX/MIN:适用于数值类型、字符串类型、时间日期类型的字段(或变量) 1.3 COUNT 1.3.1 作用:计算指定字段在查询结构中出现的个数(不包含NULL值的) #如果计算表中有多少条记录,如 阅读全文
posted @ 2024-04-03 16:55 正霜霜儿 阅读(26) 评论(0) 推荐(0) 编辑
摘要:-- 4.3 -- **************************************************************************************** 1. 多表连接 1.1 为了避免笛卡尔积,可以在where中加入有效的连接条件 SELECT tabl 阅读全文
posted @ 2024-04-03 16:52 正霜霜儿 阅读(40) 评论(0) 推荐(0) 编辑
摘要:**************************************************************************************** DML(Data Manipulation Language、数据操作语言),用于添加、删除、更新和查询数据库记 录,并检 阅读全文
posted @ 2024-04-02 18:42 正霜霜儿 阅读(80) 评论(0) 推荐(0) 编辑
摘要:SQL创建数据库 create database school USE school #(数据库名) 创建数据库表: create table students( userid INT NOT NULL PRIMARY key , lastname varchar(255), firstname v 阅读全文
posted @ 2024-04-02 08:59 正霜霜儿 阅读(6) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示