摘要: ``` #coding=utf-8 # 任何等于0的数值被认为是False,所有非零的数字被认为True, # 空的容器为False,飞控容器酒味True。 download_complete=False print bool(download_complete) print bool(-1.23) print bool(0.0) print bool('') print bool([None... 阅读全文
posted @ 2016-01-02 22:07 yufenghou 阅读(99) 评论(0) 推荐(0)
摘要: ``` #coding=utf-8 # 没有++ 和--其他的都一样 foo=1 show_output=True if show_output and foo==1: print 'pyhont and %s are number %d' % ('django',foo) # python 只有一些@符号和下划线符号,只有干净和容易阅读的代码才能避免混乱。 ``` 阅读全文
posted @ 2016-01-02 21:51 yufenghou 阅读(135) 评论(0) 推荐(0)
摘要: ``` #coding=utf-8 # python没有花括号。我们用对齐来代替括号:通常是四个空格(任意数目的空格货tab也都可以) # python 注释用 # # python不需要像其他语言那样需要首先声明一个特定的类型, # python是一门动态语言 foo='bar' print foo foo=1 print foo ``` 阅读全文
posted @ 2016-01-02 21:33 yufenghou 阅读(141) 评论(0) 推荐(0)
摘要: ``` print 'dongshen' for word in ['capitalize','these','words']: print word.upper() for i in range(0,5): print i ``` 阅读全文
posted @ 2016-01-02 21:27 yufenghou 阅读(112) 评论(0) 推荐(0)