Python List 列表 基本定义及增删改查操作

本文详细介绍了Python列表的基本特性,包括声明定义、存储任意类型对象的能力。重点讲解了如何通过索引访问元素,如正索引和负索引的使用。同时,阐述了添加元素的方法,如append()和insert()函数的用法。此外,还讨论了删除元素的操作,如del语句、pop()和remove()函数。最后提到了通过索引修改列表元素的方法。
摘要由CSDN通过智能技术生成
Basic Characteristics

A list is a collection of items in a particular order.

Declaration & define – store any object[type]
lt = [1, 1.1, 'str', ['list']] # contain type : [int, float, string, list] 
Basic Operator[CRUD]
Accessing Elements by index
           [1, 1.1, 'str', ['list']]
postive:    0   1     2        3
negative:  -4  -3    -2       -1
Positive Index – index of interval is [0, length), which begin from 0.
print(lt[0]) #output: 1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值