- 博客(4)
- 收藏
- 关注
原创 [Python] Lambda 表达式
[Python] Lambda 表达式Python版本:Python 2.7.13rc1Python Lambda 表达式 普通函数和lambda表达式的区别 嵌套作用域 将lambda表达式作为参数 嵌套lambda表达式1.普通函数和lambda表达式的区别>>> def f(x):return x**2>>> print f(8) 64>>> g = lambda x:x**2 >>> pri
2016-12-08 15:32:37 722
原创 [Python] input() vs raw_input()
Python版本:Python 2.7.13rc1ex1.py :name = input("What's your name? ") print("Nice to meet you " + name + "!") name2 = raw_input("What's your name? ") print("Nice to meet you " + name2 + "!")input():input
2016-12-16 14:45:12 212
原创 [Python]格式化输出(2)
Python版本:Python 2.7.13rc11.数字整型正确的写法:>>> print 'The value of PI is approximately %d ' % (3) The value of PI is approximately 3 >>> print 'The value of PI is approximately {:d} '.format(3) The value of
2016-12-15 13:06:54 1221
原创 [Python] 格式化输出(1)
Python版本:Python 2.7.13rc11.基本格式化输出Old style:%>>> print 'We are the %s who say "%s"!' % ('knights','Hi') We are the knights who say "Hi"!New style:str.format() method>>> print 'We are the {} who say "{}
2016-12-13 16:17:51 268
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人