
Python
strcchen
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[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 · 757 阅读 · 0 评论 -
[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 · 245 阅读 · 0 评论 -
[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 · 296 阅读 · 0 评论 -
[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 · 1273 阅读 · 0 评论