摘要: 一. 字典 #字典 dict1 = {'name':'lzc','age':'20','sex':'man'} print dict1 print type(dict1) >>> {'age': '20', 'name': 'lzc', 'sex': 'man'} >>> <type 'dict'> 阅读全文
posted @ 2017-10-23 09:12 刘振川的博客 阅读(501) 评论(0) 推荐(0) 编辑
摘要: 一.python 数据类型--字典 1.用字符串存储信息,如:存储“姓名,身高,性别”: In [1]: info='Tom 170 M' //字符串存储信息 In [3]: info[0:3] //字符串提取人名 Out[3]: 'Tom' 2.用列表存储信息 In [10]: list1 = [ 阅读全文
posted @ 2017-10-23 09:10 刘振川的博客 阅读(261) 评论(0) 推荐(0) 编辑
摘要: #/usr/bin/python#coding=utf-8#@Time :2017/10/13 15:02#@Auther :liuzhenchuan#@File :元组.py #tuple() 字符串转换成元组str1 = 'abcd efg hiop'print type(tuple(str1) 阅读全文
posted @ 2017-10-23 09:08 刘振川的博客 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 一.python的数据类型 序列--元组 1.序列 1》字符串,列表,元组都是序列。 2》序列的两个特点是索引操作符和切片操作符 索引操作符:我们可以从序列中抓取一个特定项目 切片操作符:让我们可以获取序列的一个切片,即一部分序列 2.序列的基本操作: 1》len() //求序列的长度 2》+ // 阅读全文
posted @ 2017-10-23 09:02 刘振川的博客 阅读(222) 评论(0) 推荐(0) 编辑
摘要: #/usr/bin/python #coding=utf-8 #@Time :2017/10/12 23:30 #@Auther :liuzhenchuan #@File :列表.py list1 = [1,2,3,4] print type(list1) str1 = 'abcd' print l 阅读全文
posted @ 2017-10-23 08:58 刘振川的博客 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 一.python 数据类型序列 列表 1.列表是可变型的数据类型。列表里边的元素是可变的,可以增加,可以删除。 2.列表(list)是处理一组有序项目的数据结构,即可以在列表中存储一个序列的项目。 1》列表是可变类型的数据 2》创建列表 list1 = [] list2 = list() list3 阅读全文
posted @ 2017-10-23 08:48 刘振川的博客 阅读(346) 评论(0) 推荐(0) 编辑