07 2020 档案

列举python的可变类型和不可变类型
摘要:可变的# unhashable type: 'list'# unhashable type: 'dict'# unhashable type: 'set'# 不可变# hashable type:str# hashable type:int# hashable type:bool、tuple 阅读全文

posted @ 2020-07-19 19:04 牛坚 阅读(122) 评论(0) 推荐(0)

字符串
摘要:字符串# s.len('字符串' ) 查询字符串有多少个索引# s.loewr()转换字符串中所有大写字符为小写# s.upper()转换字符串中所有小写字符为大写# s.startswhith('字符串')判断字符串是否为a的首个索引# s.count('字符串')判断字符串在a里边有多少个# s 阅读全文

posted @ 2020-07-18 15:54 牛坚 阅读(128) 评论(0) 推荐(0)

查找,冒泡排序
摘要:l1=[i for i in range(1,10)]# l1=1,2,3,4,5,6,7,8,9,10,11,12,13,14# # start_index=0# # end_index=len(l1)-1# while start_index<=end_index:# # mid_index=( 阅读全文

posted @ 2020-07-17 21:31 牛坚 阅读(117) 评论(0) 推荐(0)

追加值的次数的方法
摘要:第一种:s1 = 'python,java,php,go,c,python,java,php,go,c,python,java,php,go,c's=s1.split(',')# dic={}# for i in s:# if i not in dic:# dic[i]=1# else:# dic[ 阅读全文

posted @ 2020-07-17 14:49 牛坚 阅读(148) 评论(0) 推荐(0)

tuple的增删改查
摘要:dict = {"k1": "v1", "k2": "v2", "k3": "v3"}# dict["k4"]="v4"# # dict["k2"]="v2"# print(dict)# dict.setdefault("k2", "v2")# dict.setdefault("k4","v4")# 阅读全文

posted @ 2020-07-15 18:48 牛坚 阅读(206) 评论(1) 推荐(0)

用户的信息后面运行示意图
摘要:系统里面有多个用户,用户的信息目前保存在列表里面# users = [‘root’,‘miaoge’]# passwd = [‘123’,‘123’]# 查看后面的运行示意图,试着写出如下5个功能的实现。# 1). 注册新用户# 2). 用户登录# 3). 注销用户# 4). 显示用户信息# 5). 阅读全文

posted @ 2020-07-14 20:13 牛坚 阅读(258) 评论(0) 推荐(0)

计数,dic的创建方式,求九九乘法表
摘要:s1='char,python,nihao,ni,ni,python's=s1.split(',')print(s1)s2=list()for i in s: if i not in s2: s2.append(i) s2.append(1) else: if i in s2: s2[s2.inde 阅读全文

posted @ 2020-07-14 19:14 牛坚 阅读(174) 评论(0) 推荐(0)

for循环迭代可迭代对象
摘要:模仿for循环迭代可迭代对象,# for i in Iterable:# iterable >>> 迭代器。iterator# 可迭代对象 iterable# 迭代器。iterator# re = range(5).__iter__()# print(re)# print(re.__next__() 阅读全文

posted @ 2020-07-14 19:02 牛坚 阅读(412) 评论(0) 推荐(0)

list列表
摘要:list# [1,2,3,4,miaoge,9.8]# list_01 = list('nihao')# print(list_01)# 列表推导式# (发生变化后标签 标签 for in iterbale)# i;i*2 for i in# i可迭代对象里面的元素筛选条件# list_01 = [ 阅读全文

posted @ 2020-07-08 16:18 牛坚 阅读(145) 评论(0) 推荐(0)

导航