Python中的单下划线和双下划线

Python中单下划线和双下划线 1 2 3 4 5 6 7 8 9 10 11 12 13 14 >>> class MyClass(): ... def __init__(self): ... self.__superprivate = "Hello" ... self._semiprivate = ", world!" ... >>> mc = MyClass() >>> print mc.__superprivate Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: myClass instance has no attribute

Python中的参数传递

Python的函数参数传递 先看下面两段代码 1 2 3 4 5 6 7 8 9 10 11 12 13 # List - a mutable type def try_to_change_list_contents(the_list): print('got', the_list) the_list.append('four') print('changed:', the_list) the_list = ['one', 'two', 'three', 'four', 'five'] print('changed:', the_list) outer_list = ['one', 'two', 'three'] if __name__ == '__main__': print('before, outer_list=', outer_list) try_to_change_list_contents(outer_list) print('after,

tornado的XSRF防护

XSRF XSRF(Cross-site request forgery,跨站请求伪造),也被简写为 CSRF,发音为”sea surf”,这是一个常见的安全漏洞(这里