python小技巧
来源:互联网 发布:破解 经淘宝排查认定 编辑:程序博客网 时间:2024/05/28 09:34
# -*- coding: utf8 -*-# 三元运算符x = 0y = 10cond = Truez = x if cond else yprint z# python 2.5加入# for-in-else# 即在for 循环中,如果没有从任何一个break中退出,则会执行和for对应的else# 只要从break中退出了,则else部分不执行。for i in range(10):if i > 10:breakelse:print 'There is no number bigger than 10'# 打印一个对象def prn_obj(obj): print ', '.join(['%s:%s' % item for item in obj.__dict__.items()])def test():m = 1def f1():m = 2def f2():print(m)f1()f2()test()
0 0
- Python Collection 小技巧
- python小技巧
- Python Collection 小技巧
- [整理]python 小技巧
- Python Collection 小技巧
- python 小技巧
- python 小技巧备注
- Python小技巧1
- Python 小技巧
- Python小技巧1
- Python Collection 小技巧
- python入门小技巧
- python 常用小技巧
- python小技巧
- Python使用小技巧
- Python实用小技巧
- Python小技巧
- python几个小技巧
- Messenger/Handler and Binder
- JQueryEasyUi学习笔记
- Cordova android框架详解
- Oracle 实例内存结构
- LeetCode 258 -Add Digits ( JAVA )
- python小技巧
- Android进阶——属性动画Property Animation详解(一)
- mac mysql 5.7.11 安装成功之后忘记密码
- 《剑指Offer》学习笔记——从尾到头打印链表
- hibernate @Temporal
- 11gRAC对单机dataguard
- 安卓事件分发机制
- Android使用GridView实现简单的日历
- SharePoint2013 IT Professional - 如何在SharePoint Site Collection中上传被限制的文档类型?