"""
#开发人员:GG bond python!!!(注释Ctrl+/)
#开发时间:2023/10/11
#实时时间:16:47
#文件名称:数据容器
#开发工具:PyCharm
"""
my_list = [1,2,3,4,5]
my_tuple = (1,2,3,4,5)
my_str = "abcdefg"
my_set = {1,2,3,4,5,6}
my_dict = {"key1": 1,"key2": 2,"key3": 3,"key4": 4,"key5": 5 }
# len元素个数
print(f"列表 元素个数有: {len(my_list)}")
print(f"元组 元素个数有: {len(my_tuple)}")
print(f"字符串 元素个数有: {len(my_str)}")
print(f"集合 元素个数有: {len(my_set)}")
print(f"字典 元素个数有: {len(my_dict)}")
# max最大元素
print(f"列表 最大的元素是: {max(my_list)}")
print(f"元组 最大的元素是: {max(my_tuple)}")
print(f"字符串 最大的元素是: {max(my_str)}")
print(f"集合 最大的元素是: {max(my_set)}")
print(f"字典 最大的元素是: {max(my_dict)}")
# min最小元素
print(f"列表 最小的元素是: {min(my_list)}")
print(f"元组 最小的元素是: {min(my_tuple)}")
print(f"字符串 最小的元素是: {min(my_str)}")
print(f"集合 最小的元素是: {min(my_set)}")
print(f"字典 最小的元素是: {min(my_dict)}")
# 通用类型转换: 容器转列表
print(f"列表 转列表的结果是:{list(my_list)}")
print(f"元组 转列表的结果是:{list(my_tuple)}")
print(f"字符串 转列表的结果是:{list(my_str)}")
print(f"集合 转列表的结果是:{list(my_set)}")
print(f"字典 转列表的结果是:{list(my_dict)}")
# 类型转换:容器转元组
print(f"列表 转元组的结果是:{tuple(my_list)}")
print(f"元组 转元组的结果是:{tuple(my_tuple)}")
print(f"字符串转元组的结果是:{tuple(my_str)}")
print(f"集合 转元组的结果是:{tuple(my_set)}")
print(f"字典 转元组的结果是:{tuple(my_dict)}")
# 类型转换:容器转字符串
print(f"列表 转字符串的结果是:{str(my_list)}")
print(f"元组 转字符串的结果是:{str(my_tuple)}")
print(f"字符串转字符串的结果是:{str(my_str)}")
print(f"集合 转字符串的结果是:{str(my_set)}")
print(f"字典 转字符串的结果是:{str(my_dict)}")
# 类型转换:容器转集合
print(f"列表 转集合的结果是:{set(my_list)}")
print(f"元组 转集合的结果是:{set(my_tuple)}")
print(f"字符串转集合的结果是:{set(my_str)}")
print(f"集合 转集合的结果是:{set(my_set)}")
print(f"字典 转集合的结果是:{set(my_dict)}")
# 通用排序功能 sorted(容器)
my_list = [8,4,6,41,61,8]
my_tuple = (5,4,21,8,6)
my_str = "hksfdkjankj"
my_set = {5,1,6,8,56,61}
my_dict = {"key1": 1,"key2": 2,"key3": 3,"key4": 4,"key5": 5 }
# 正向排序 sorted(容器)
print(f"列表对象的排序结果:{sorted(my_list)}")
print(f"元组对象的排序结果:{sorted(my_tuple)}")
print(f"字符串对象的排序结果:{sorted(my_str)}")
print(f"集合对象的排序结果:{sorted(my_set)}")
print(f"字典对象的排序结果:{sorted(my_dict)}") # 拍完序之后都会变成列表
# 反向排序 sorted(容器,reverse=True)
print(f"列表对象的反向排序结果:{sorted(my_list,reverse=True)}")
print(f"元组对象的反向排序结果:{sorted(my_tuple,reverse=True)}")
print(f"字符串对象的反向排序结果:{sorted(my_str,reverse=True)}")
print(f"集合对象的反向排序结果:{sorted(my_set,reverse=True)}")
print(f"字典对象的反向排序结果:{sorted(my_dict,reverse=True)}")
print(" ".join([chr(i) for i in range(0xf08c,0xf095)]))
没有合适的资源?快使用搜索试试~ 我知道了~
Python学习详细笔记
共208个文件
py:132个
xml:42个
gitignore:9个
需积分: 0 1 下载量 162 浏览量
2023-10-25
16:58:39
上传
评论
收藏 145KB ZIP 举报
温馨提示
Python 是一种多范式,通用,解释的高级编程语言。Python 允许程序员使用不同的编程风格来创建简单或复杂的程序,获得更快的结果并编写代码,就像用人类语言说话一样。一些流行的系统和应用程序 在开发过程中使用 Python 的包括 Google 搜索,YouTube,BitTorrent,Google App Engine,Eve Online,Maya 和 iRobot 机器。Python 的初步开发是由 Guido van Rossum 在 20 世纪 80 年代末率先发起的。今天,它由 Python 软件基金会开发。因为 Python 是一种多范式语言,Python 程序员可以使用不同的编程风格完成他们的任务:面向对象,命令式,功能性或反射性。Python 可用于 Web 开发,数字编程,游戏开发,串行端口访问等。Python 是一种解释型语言,它排除了在执行程序之前编译代码的需要,因为 Python 在后台进行编译。因为 Python 是一种高级编程语言,所以它从编程代码中抽象出许多复杂的细节。Python 非常关注这种抽象,大多数新手程序员都可以理解它的代码。 Pytho
资源推荐
资源详情
资源评论
收起资源包目录
Python学习详细笔记 (208个子文件)
.gitignore 50B
.gitignore 50B
.gitignore 50B
.gitignore 50B
.gitignore 50B
.gitignore 50B
.gitignore 50B
.gitignore 50B
.gitignore 50B
1960-2019全球GDP数据.html 260KB
基础时间线柱状图.html 16KB
全国疫情.html 11KB
render.html 8KB
河南省疫情统计.html 8KB
陕西省疫情统计.html 7KB
render.html 5KB
render.html 4KB
test5.iml 291B
test4.iml 291B
test.iml 291B
test8.iml 291B
test6.iml 291B
test$.iml 291B
test2.iml 291B
test3.iml 291B
test7.iml 291B
数据容器类型转换.py 4KB
黑马atm.py 3KB
pyecharts疫情.py 2KB
动态柱状图.py 2KB
异常捕获.py 2KB
黑马银行ATM1.py 2KB
集合.py 2KB
if嵌套判断语句.py 2KB
陕西.py 2KB
pyecharts省疫情.py 2KB
字符串格式化精度控制.py 2KB
植物大战僵尸.py 2KB
dict字典的常规操作.py 2KB
基础动态柱状图.py 1KB
模块.py 1KB
多继承.py 1KB
3 列表的查询修改追加.py 1KB
tuple(元组).py 1KB
if嵌套2 猜数字案例.py 1KB
函数多种发传参方式.py 1KB
1.r模式--文件读取.py 1KB
5案例(构造函数).py 1KB
dict字典.py 1KB
点餐.py 1KB
升职加薪.py 1KB
7封装.py 1KB
7封装.py 1KB
json数据格式.py 1KB
地图图表.py 1KB
str(字符串).py 1KB
6魔术方法.py 1KB
2 列表索引.py 1KB
while账号.py 1KB
黑马ATM.py 1KB
while实现1-100的和.py 1KB
flie_util.py 1KB
字符串格式化占位型.py 1019B
if嵌套判断.py 1006B
if eif else 互斥.py 947B
pycharts入门.py 943B
2对象.py 940B
返回值.py 938B
3类和对象.py 936B
4 列表删除元素.py 933B
while循环遍历(迭代).py 931B
2.w模式--文件写入.py 922B
1类.py 909B
for循环嵌套使用.py 909B
while循环的基础应用.py 890B
while循环.py 890B
while嵌套循环.py 883B
序列切片.py 869B
单词计数2.py 861B
逻辑判断.py 813B
whil循环心得.py 808B
range语句.py 789B
for循环.py 784B
while循环九九乘法表.py 779B
srot方法.py 778B
综合案例发工资.py 759B
单继承.py 758B
股价计算小程序.py 737B
案例.py 737B
str_util.py 736B
字符串拼接.py 709B
4对属性赋值(构造方法).py 702B
函数.py 699B
账单文件2.py 670B
综合案例发工资2.py 669B
input数据输入.py 659B
input键盘输入.py 651B
3.a模式--文件的追加.py 632B
异常捕获总结.py 611B
健康码.py 608B
共 208 条
- 1
- 2
- 3
资源评论
GGBond.zip
- 粉丝: 11
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功