python advance program

2014 年 3 月 19 日
 hupantingxue
汇总了一些python高阶编程的范例,比如list comprehension, generator, Decorators, map, reduce, Higher-order function...大家一起学习学习:
https://github.com/hupantingxue/advancedpython
5259 次点击
所在节点    Python
11 条回复
Froshal
2014 年 3 月 19 日
谢谢分享
a2z
2014 年 3 月 19 日
感谢分享
raquelken
2014 年 3 月 19 日
分享是好事,但是希望能写正确。。。
cocorosiekz
2014 年 3 月 19 日
python官网有how to系列,其中有函数式编程部分,地址http://docs.python.org/2/howto/functional.html
hupantingxue
2014 年 3 月 19 日
@raquelken 有问题可以直接给我提issue,谢谢!
ljcarsenal
2014 年 3 月 19 日
马克
yakczh
2014 年 3 月 19 日
问个低阶的问题
怎么用format格式化tuple的子项
比如
tu=('Server', 'Apache/2.2.4 ')

print(" {0}:{1} ".format(tu))
想输出 Server : Apache/2.2.4
但是提示tuple index out of range
polythene
2014 年 3 月 19 日
@yakczh try: print(" {0}:{1} ".format(*tu))
yakczh
2014 年 3 月 19 日
@polythene 文档中没看到这种用法,能解释下吗?
lsj5031
2014 年 3 月 19 日
@yakczh
unpack the tuple/sequence/collection into positional arguments.
因为format要跟的参数不是这个tuple,而是你那两个string。
hupantingxue
2014 年 7 月 16 日
更新了一下

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/104960

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX