摘要: 1.语法: {'key':'value','key1':'value1'} #names = {'jhj':[18,'女','东北'], # 'zxf':{'age':19,'sex':'男','addr':'内蒙'}} #定义字典 2.增: #names['nhy']=[20,'男','北京'] 阅读全文
posted @ 2016-11-13 18:14 minminmt 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 一、文件的操作方法: 常用的文件操作方法:open,read,write,writeline,writelines,writeable,readline,readlines 二、读 1.打开一个文件open()(Python2,open和file都可以打开文件,Python3只有open方法可以打开 阅读全文
posted @ 2016-11-13 16:12 minminmt 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 算术运算符 1.常用算术运算符+,-,*,/,%,//,** +可以是字符串,列表的拼接,也可以是数据类型的运算 # (a/b) #除 # (a//b)#取整除,返回商的整数部分 2.部分实例: #a=[1,2,3] #b=['a','b','c'] #c=23 ,d=12 #print(a+b) 阅读全文
posted @ 2016-11-13 15:28 minminmt 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 字符串:字符串操作的方法,都不会改变字符串的原值 1.字符串常用的方法:count,find,join,encode,decode,endswith,startswith,isdigit,strip,replace,split,splitlines 2.count() 统计某个字符串出现的次数 #p 阅读全文
posted @ 2016-11-13 14:21 minminmt 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 一、定义列表 1.names = ['mike','mark','candice','laular'] #定义列表 2.num_list = list(range(1,10)) #range生成1-10范围内的数,并强制转化成列表 二、增:append()、insert()方法 1.append() 阅读全文
posted @ 2016-11-13 12:10 minminmt 阅读(8148) 评论(0) 推荐(2) 编辑