python类型
2015-07-27 22:02
856 查看
本文主要总结python的集中数据类型。
1)字符创(string)
str = 'l love China'
print str
2))列表(list)
list = ['abc',12,'12']
list.append()
list.remove()
2)元组(tuple)可以认为是只读的list,不可修改。
tup = ('abc',12,'12')
print tup[0]
3)字典(dictionary)。列表是有序的对象集合,字典是无序的对象集合。字典中的元素通过键来取值,而列表的元素是通过偏移来取值的。
dict = {'123':35,11:'sp'}
dict['123']
del dict[]
del dict
dict.clear()
4)集合(set )。集合可以有list初始化。
a = set([])
a.add(123)
a.remove()
1)字符创(string)
str = 'l love China'
print str
2))列表(list)
list = ['abc',12,'12']
list.append()
list.remove()
2)元组(tuple)可以认为是只读的list,不可修改。
tup = ('abc',12,'12')
print tup[0]
3)字典(dictionary)。列表是有序的对象集合,字典是无序的对象集合。字典中的元素通过键来取值,而列表的元素是通过偏移来取值的。
dict = {'123':35,11:'sp'}
dict['123']
del dict[]
del dict
dict.clear()
4)集合(set )。集合可以有list初始化。
a = set([])
a.add(123)
a.remove()
相关文章推荐
- 使用python内置pip工具来安装wheel文件
- Python reportlab教程
- caffe python批量抽取图像特征
- 助手系列之python的FTP服务器
- python变量、运算符、表达式、数据类型
- Python脚本调试方法
- python 用pyftplib快速建设ftp
- Vim的Python编辑器详细配置过程 (Based on Ubuntu 12.04 LTS)
- python中如何表示多维数组(即矩阵形式)
- Python 从 mat 文件读写 到 h5py 文件包
- numpy函数库中一些常用函数的记录
- python学习笔记(一)
- 如何调用另一个python文件中的代码
- [python]小技巧集锦
- Python程序的执行原理
- python中出现IndentationError:unindent does not match any outer indentation level错误
- Django+python实现网页数据的excel导出
- python学习 - yield
- Alternating Least Squares(ASL) for Implicit Feedback Datasets的数学推导以及用Python实现
- ubuntu python 安装