摘要: #如果函数中没有return,函数就没有返回值,那么很多功能就无法实现1. returns = 'dfgfg'def my_len(): #自定义函数 i = 0 for k in s: i = i + 1 return i #返回值length = my_len() #接收返回值print(len 阅读全文
posted @ 2021-08-24 22:22 hbfengj 阅读(51) 评论(0) 推荐(0)
摘要: #读f = open('d:\file.txt', mode='r', encoding='utf-8') #文件读,content = f.read() #bytes > strprint(content)f.close() f = open('d:\file.txt', mode='rb') # 阅读全文
posted @ 2021-08-24 22:17 hbfengj 阅读(42) 评论(0) 推荐(0)
摘要: # = 赋值 == 比较值是否相等 is 比较内存地址是否相同 id(查看内存地址)li1 = [1,2,3]li2 = li1print(li1 is li2)print(id(li1),id(li2)) #编码1. 各个编码之间的二进制,是不能互相识别的,会产生乱码utf-8不能识别gbk编码的 阅读全文
posted @ 2021-08-18 21:01 hbfengj 阅读(153) 评论(0) 推荐(0)
摘要: 1. 数据类型划分:可变数据类型,不可变数据类型不可变数据类型:tuple,bool,int,str #可哈西可变数据类型:list dict set dict key 必须是不可变数据类型 value:任意数据类型 2. 增删改查dic1 = {'age':18, 'name':'joe', 's 阅读全文
posted @ 2021-08-17 21:09 hbfengj 阅读(45) 评论(0) 推荐(0)
摘要: 1. 切片li = ['alex', [1,2,3], 'wusir','egon']l1 = li[0]print(l1)l2 = li[0:3]print(l2) li = ['alex', [1,2,3], 'wusir','egon']#增加 append 增加到最后li.append('日 阅读全文
posted @ 2021-08-16 19:25 hbfengj 阅读(34) 评论(0) 推荐(0)
摘要: 1. 数据类型int,bool,str,listtuple:只读()dictset:{} 2. str索引与切片(1) s = 'sddsdsd' #索引值从0开始s1 = s[0]print(s1) #sdds 切片:顾头不顾尾s2 = s[0:4] print(s2) #取字符串最后一位s3 = 阅读全文
posted @ 2021-08-09 21:40 hbfengj 阅读(78) 评论(0) 推荐(0)
摘要: 1. 格式化输出# %(占位) s(字符串) d(数字)(1)msg = "我叫$s,今年%d,身高%d,学习进度为3%%" %(name,age,height) 2. while else#当while被break打断,就不走else 当while不被break打断,就走else 3. 编码(1) 阅读全文
posted @ 2021-08-08 19:08 hbfengj 阅读(117) 评论(0) 推荐(0)
摘要: 1. python的环境编译型:把代码一次性编译成二进制文件缺点:开发效率低,不能跨平台优点:执行速度快c c++解释型:当程序执行时,一行一行的编译成二进制优点:开发效率高,可以跨平台缺点:运行速度慢python php 2. 解释器(1)代码运行先交给解释器,在交给cpu写的python代码必须 阅读全文
posted @ 2021-08-08 15:24 hbfengj 阅读(42) 评论(0) 推荐(0)
摘要: 一:自增列起始值和步长1. 自增列起始值查看和修改 show create table t1 \G; alter table t1 set auto_increment=2;2. 步长 会话 全局 二:索引和外键 1. 唯一索引 create table t1( id in auto_increme 阅读全文
posted @ 2020-04-01 11:25 hbfengj 阅读(161) 评论(0) 推荐(0)
摘要: 一: 关系型与非关系型数据库1. 表与表之间能创建关系,建立外键,这就是关系型;Oracle、MySQL、db22. 非关系,表与表不能创建关系;Redis MongoDB 二: 添加用户和授权(添加用户必须要授权)1. create user 'alex'@'192.168.1.%' identi 阅读全文
posted @ 2020-04-01 11:18 hbfengj 阅读(131) 评论(0) 推荐(0)