摘要: 1、关于i++python 中的没有 i++ ,如果写了会报语法错误。但是python 中有 --i,++i,+-i,-+i,他们不是实现-1操作的,仅仅是作为判断运算符号,类似数学中的负负得正i = 2print ++i //2print -+i //-2print +-i //-2print --i //22、逻辑表达式python 中没有 && ,!, || 这3个运算符,在逻辑表达式中写成这3个会抱逻辑错误的。要实现同样的功能,要写成 and,not,or返回值 2 and 3 返回3返回值 2 or 3 返回2返回值 not 2 and 3 返回 False 阅读全文
posted @ 2013-09-29 16:24 yupeng 阅读(17268) 评论(0) 推荐(0) 编辑
摘要: 1.map(function,sequence) 对sequence 中的item依次执行function(item),见执行结果组成一个List返回例如:#!/usr/bin/python# -*- coding: utf-8 -*-def add100(x): return x+100hh = [10,11,12]print(map(add100,hh))def abc(a,b,c): return a*1000+b*100+clist1 = [11,22,33]list2 = [44,55,66]list3 = [77,88,99]print(map(abc,list1,li... 阅读全文
posted @ 2013-09-29 16:01 yupeng 阅读(6657) 评论(0) 推荐(0) 编辑