Python学习
记录Python学习中的知识点
言语肤浅
这个作者很懒,什么都没留下…
展开
-
Python学习日记3------字典
字典是python内置的数据结构之一,与列表一样是一个可变序列(可进行增删改)。一、字典的创建1、使用{}dic = {'nihao':123,'lll':456}nihao为键,123为值dic1 = {'hello':111,'python':222,'zj':333}print(dic1)#{'hello': 111, 'python': 222, 'zj': 333}2、使用内置函数dict()dic2 = dict(name='yuzu',age=24,ah='hh')pri原创 2021-07-20 16:23:40 · 125 阅读 · 0 评论 -
Python学习日记2------列表
Python学习日记2------列表变量可以存储一个元素,而列表是一个“大容器”,可以存储N多个元素,程序可以方便地对这些数据进行整体操作列表相当于其它语言中的数组1、列表的创建列表需要使用中括号[],元素之间使用英文的逗号进行分割创建方式有两种:(1) 使用中括号(2) 调用内置函数list()2、列表的特点(1) 列表元素按顺序有序排序(2) 索引映射唯一数据0、1、2、3、4/-5、-4、-3、-2、-1#创建列表对象,第一种_lst1 = ['hello','python原创 2020-11-13 21:29:25 · 196 阅读 · 0 评论 -
Python学习日记2
Python学习日记21、程序的顺序结构#起床分几步print(‘1.睁眼’)print(‘2.穿衣服’)print(‘3.整理被褥’)print(‘4.洗漱’)2、对象的布尔值print('----------以下对象的布尔值为False-----------')print(bool(False))print(bool(0))print(bool(0.0))print(bool(None))print(bool(''))print(bool(""))print(bool([]原创 2020-11-13 21:05:07 · 113 阅读 · 0 评论