摘要:
https://www.codecademy.com/en/courses/learn-the-command-line Background The command line is a text interface for your computer. It's a program that ta 阅读全文
摘要:
1.关于global声明变量的错误例子I ran across this warning:#!/usr/bin/env python2.3VAR = 'xxx'if __name__ == '__main__': global VAR VAR = 'yyy'---OUTPUT:./var... 阅读全文
摘要:
转自 http://blog.csdn.net/sasoritattoo/article/details/12451359代码中经常会有变量是否为None的判断,有三种主要的写法:第一种是`if x is None`;第二种是 `if not x:`;第三种是`if not x is None`(这... 阅读全文
摘要:
__slots__如果我们想要限制class的属性怎么办?比如,只允许对Student实例添加name和age属性。为了达到限制的目的,Python允许在定义class的时候,定义一个特殊的__slots__变量,来限制该class能添加的属性:>>> class Student(object):.... 阅读全文