上一页 1 ··· 8 9 10 11 12
摘要: (10, 'alex') (11, 'eric') (12, 'Roman') 结论: enumerate方便给元素添加一个自增的序号 99 c 结论:ord可以将字符转为ascii码,chr可以将ascii转为字符串 [[1, 2], [3, 4], [5, 6], [7, 8], [9, 0]] 阅读全文
posted @ 2016-05-02 00:40 Alex0425 阅读(250) 评论(0) 推荐(0) 编辑
摘要: def fun(a): a = a +1 return aprint (fun(4))结果:5fun2 = lambda a:a+1 #冒号前为形参,可以是多个;冒号后面的函数体print (fun2(18))结果:19 阅读全文
posted @ 2016-05-01 12:14 Alex0425 阅读(244) 评论(0) 推荐(0) 编辑
摘要: ([11, 22, 33], [44], ['a', 'b']) <class 'tuple'> {'k2': 'v2', 'k1': 'v1'} <class 'dict'> 结论:同时传递两个带*号的参数,在形参定义里,第一个形参只能是带一个*号,第二个形参只能是带两个*号,同时在参数传递的时候 阅读全文
posted @ 2016-05-01 10:17 Alex0425 阅读(440) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:UTF-8 -*- #需要在邮箱处设置开启SMTP服务(第三方客户端发送) import smtplibfrom email.mime.text import MIMETextfrom email.utils import for 阅读全文
posted @ 2016-05-01 09:12 Alex0425 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1.针对字符和数字的赋值,深拷贝与浅拷贝 24266496 24266496 结论:对于赋值操作,内存地址是一致的。 5129984 5129984 结论:对于浅拷贝,内存地址也是一致的 24069888 24069888 结论:对于深拷贝,内存地址也是一致的 2.针对列表,元祖与字典的赋值,深拷贝 阅读全文
posted @ 2016-04-30 14:21 Alex0425 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Counter({'a': 5, 'b': 4, 'c': 3, 'd': 2, 'e': 1}) a 5 c 3 e 1 d 2 b 4 结论:统计各个字符串出现的次数 OrderedDict {'k1': [11, 22, 33, 44, 55]} {'k2': [66, 77, 88, 99] 阅读全文
posted @ 2016-04-30 13:19 Alex0425 阅读(243) 评论(0) 推荐(0) 编辑
摘要: T:h:i:s: :I:s: :S:t:r:i:n:g: :E:x:a:m:p:l:e:.:.:.:W:o:w:!:!:! This:is:a:book This:is:a:book 2-4-1-3 <class 'dict'> {97: 49, 98: 50, 99: 51, 100: 52, 1 阅读全文
posted @ 2016-04-30 00:24 Alex0425 阅读(433) 评论(0) 推荐(0) 编辑
摘要: {1, 2, 3, 4, 5}{3, 4, 6}{1, 2, 5} 结论:difference计算在s1集合中但是不在s2集合中的内容,并且生成一个新的集合s3,原来s1,s2不变 {1, 2, 5}{3, 4, 6}None 结论:difference_update计算了在s1集合中但是不在s2集 阅读全文
posted @ 2016-04-29 01:55 Alex0425 阅读(401) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12