- 博客(3)
- 收藏
- 关注
原创 python中关于集合
1.集合的定义 集合 d = {'james':99,'jack':88}#字典 s1 = {1,2,3,4,5,6,7}#集合 s2 = {11,223,44,33,55} print(s1) '''set()方法来创建集合--列表list() 字典dict() 元组tuple()''' s1 = set(range(6)) print(s1,type(s1)) s = ([1,2,3,4,5]) print(s,type(s)) ss = set((1,2,3,4,5,6,7,8))#集合
2022-04-12 14:02:09
480
原创 python中关于元组
1.什么是元组 元组是不可变()使用的是小括号和逗号 lst = [1,2,3,4] print(id(lst)) lst.append(5) print(lst) print(id(lst)) str = 'hello' print(id(str)) str = str+'world' print(id(str)) print(str) 2.元组的创建
2022-04-07 22:13:32
714
原创 python中关于字典
话不多说直接代码搞定 首先字典的创建 '''使用{创造了字典str int dict''' s = {'张呈':100,'james':101,'王根基':70} print(s) order = {'订单号': 10032,'时间':202110807,'价格':9.9,'金额':99} print(order) print(type(order)) '''第二种方式创建字典''' order = dict(订单号='10032',时间 = '20210807') print(type(order
2022-04-05 12:41:08
577
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人