Fourth: 基本数据类型-List

List 也就是数组,但是这个数组是动态的,用中括号与逗号创建。

Python knows a number of compound data types, used to group together other values. The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. Lists might contain items of different types, but usually the items all have the same type.

1) Like strings (and all other built-in sequence type), lists can be indexed and sliced.

2) All slice operations return a new list containing the requested elements.

3) Lists also support operations like concatenation.用 + 进行连接

4) Unlike strings, which are immutable, lists are a mutable type.

5) You can also add new items at the end of the list, by using the append() method.

6Assignment to slices is also possible, and this can even change the size of the list or clear it entirely.

7) The built-in function len() also applies to lists.

8) It is possible to nest lists (create lists containing other lists).

以下是今天做的一些小练习

时间: 2024-08-11 09:40:52

Fourth: 基本数据类型-List的相关文章

OC变量数据类型

// //  main.m //  OC10变量数据类型 // //  Created by Zoujie on 15/9/4. //  Copyright (c) 2015年 Zoujie. All rights reserved. // enum flag {     FIREST,     SECOND,     THIRD,     FOURTH=5,     FIFTH,      }ENDOFDATA; //未命名的枚举类型 enum {     up,     down,     

Python Fourth Day

一.函数补充进阶 1.函数对象: 函数是第一类对象,即函数可以当作数据传递,它的应用形式也被称为高阶函数,函数的特性如下: a. 可以被引用 1 # def foo(): 2 # print('from foo') 3 # 4 # func = foo 5 # print(foo) # 不加括号为foo函数的内存地址 6 # print(func) # func指向foo内存地址 7 # func() # foo内存地址,加()执行 8 ''' 9 结果: 10 <function foo at

MariaDB(MySQL)创建、删除、选择及数据类型使用详解

一.MariaDB简介(MySQL简介略过) MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品.在存储引擎方面,使用XtraDB(英语:XtraDB)来代替MySQL的InnoDB. MariaDB由MySQL的创始人Michael Widenius(英语:Michael Widenius)主导开发,他早前曾以10亿美元的价格,将自己创建的公司MySQL A

JavaScript数据类型检测

一.JavaScript 数据类型 1.基本数据类型(6种) Undefined Null Boolean Number String Symbol (ES6新增) 2.引用数据类型: Object 二.数据类型检测 1. typeof 可以检测除null 外的基本类型.null 和所有对象的typeof都是"object", 不能用于检测用户自定义类型. 比如Date, RegExp, Array, DOM Element的类型都是"object". var s

【个人笔记】《知了堂》MySQL中的数据类型

MySQL中的数据类型 1.整型 MySQL数据类型 含义(有符号) tinyint(m) 1个字节  范围(-128~127) smallint(m) 2个字节  范围(-32768~32767) mediumint(m) 3个字节  范围(-8388608~8388607) int(m) 4个字节  范围(-2147483648~2147483647) bigint(m) 8个字节  范围(+-9.22*10的18次方) 取值范围如果加了unsigned,则最大值翻倍,如tinyint un

英文词频统计预备 组合数据类型练习

1.实例: 下载一首英文的歌词或文章,将所有,.?!等替换为空格,将所有大写转换为小写,统计某几个单词出现的次数,分隔出一个一个的单词. big='''OoohOooh Put your make-up onGet your nails doneCurl your hairRun the extra mileKeep it slim so they like you, do they like you? Get your sexy onDon't be shy, girlTake it offT

Java基础——数据类型

声明:本栏目所使用的素材都是凯哥学堂VIP学员所写,学员有权匿名,对文章有最终解释权:凯哥学堂旨在促进VIP学员互相学习的基础上公开笔记. 一.数据类型(八种): 1.计算机的存储进位:位是最小的存储数据单位,以此类推,如图: 2.在java里我们可以使用 0b或者0x表示二进制和十六进 如:0xABC或0b01010001: 3.在java里面数据存储中高位是1 就是负数,高位是0 就是正数: 4.Java数据类型详解: 整数数值:int short:小于32767 byte:小于127 小数

python数据类型详解

主要内容: 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 列表与元组 定义列表 1 list = ['a' , 'b', 'c', 'd'] 通过下标访问列表中的元素,下标从0开始计数 1 list[0] # 'a' 2 list[1] # 'b' 3 list[-1] # 'd' 4 list[-2] # 'c' 基本操作: 切片:取多个元素 1 list = ["A","B","C","D",&

MongoDB的数据类型(四)

JSON JSON是一种简单的数据表示方式,它易于理解.易于解析.易于记忆.但从另一方面来说,因为只有null.布尔.数字.字符串.数组和对象这几种数据类型,所以JSON有一定局限性.例如,JSON没有日期类型,JSON只有一种数字类型,无法区分浮点数和整数,更别说区分32为和64位数字了.再者,JSON无法表示其他一些通用类型,如正则表达式或函数. BSON BSON(Binary Serialized Document Format)是一种类JSON的二进制形式的存储格式,简称Binary