随笔分类 - Python
摘要:running install running build running build_py creating build creating build/lib.linux-x86_64-3.4 copying ./rjsmin.py -> build/lib.linux-x86_64-3.4 ru
阅读全文
摘要:python manage.py compress python manage.py collectstatic
阅读全文
摘要:Metadata-Version: 2.0Name: hackingVersion: 0.10.2Summary: OpenStack Hacking Guideline EnforcementHome-page: http://github.com/openstack-dev/hackingAut
阅读全文
摘要:Building Contributor Documentation This documentation is written by contributors, for contributors. The source is maintained in the doc/source directo
阅读全文
摘要:1.Python pdb调试的几种方式。(1)python -m pdb SumTest.pyimport pdbdef add(a, b): print(a) print(b) c = a + b print(c)add(10, 20) 在命令行执行上述命令,在Linux...
阅读全文
摘要:Paste has been under development for a while, and has lots of code in it.The code is largely decoupled except for some core functions shared by many p...
阅读全文
摘要:Introduction Web Services Made Easy (WSME) simplifies the writing of REST web services by providing simple yet powerful typing, removing the need to...
阅读全文
摘要:Pecan Introduce Pecan是一个轻量级的基于Python的Web框架, Pecan的目标并不是要成为一个“full stack”的框架, 因此Pecan本身不支持类似Session和Databases.Pecan Features (1)Object-dispatch for...
阅读全文
摘要:def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) return 'Hello, web!'# 1st# Just for Test and...
阅读全文
摘要:1. WSGIServer WSGIMiddlewareWSGIApplication1.1 WSGI Server wsgi server可以理解为一个符合wsgi规范的web server,接收request请求,封装一系列环境变量,按照wsgi规范调用注册的wsgi app,最后将resp...
阅读全文
摘要:在Python项目里面的区分,按照如下规定进行: 1.严格区分包和文件夹。包的定义就是包含__init__.py的文件夹。 如果没有__init__.py,那么就是普通的文件夹。 2.导入package。 在python 安装目录的site-package文件夹中新建xxx.pt...
阅读全文
摘要:WSGI是Web Service Gateway Interface的缩写。WSGI标准在PEP(Python Enhancement Proposal)中定义并被许多框架实现,其中包括现广泛使用的django框架。PythonWeb服务器接口(Python Web Server Gateway I...
阅读全文
摘要:Eventlet是一个用来处理和网络相关的python网络库,而且可以通过协程来实现并发,在eventlet里,把“协程”叫做greenthread。所谓并发,就是开启了多个greenthread,并且对这些greenthread进行管理,以实现非阻塞式的I/O。关于协程,大致可以理解成允许子程序可...
阅读全文
摘要:魔术方法调用方式解释__new__(cls [,...])instance = MyClass(arg1, arg2)__new__ 在创建实例的时候被调用__init__(self [,...])instance = MyClass(arg1, arg2)__init__ 在创建实例的时候被调用_...
阅读全文
摘要:metaclasses元类:就像对象是类的实例一样,类是它的元类的实例。调用元类可以创建类。metaclass使用type来创建类,type可以被继承生成新的元类。这个和C#的反射很相似。下面是一个通过元类创建类的事例:def __init__(self): self.message='hel...
阅读全文
摘要:普通的方法,第一个参数需要是self,它表示一个具体的实例本身。如果用了staticmethod,那么就可以无视这个self,而将这个方法当成一个普通的函数使用。而对于classmethod,它的第一个参数不是self,是cls,它表示这个类本身。>>> class A(object): de...
阅读全文
摘要:1.print和print()2.yield出现下面的错误Traceback (most recent call last): File “”, line 1, in f.next()AttributeError: ‘generator’ object has no attribute ‘...
阅读全文
摘要:Python可以继承多个父类,多重继承。类支持多个对象的产生,命名空间的继承,运算符重载1)、类产生多个实例对象Python OOP模型中的两种对象:类对象和实例对象。类对象提供默认的行为,是实例对象的工厂。实例对象是程序处理的实际对象:各自都有独立的命名空间。类对象来至于语句,而实例来至于调用。每...
阅读全文
摘要:一、方法1: 单文件模块直接把文件拷贝到 $python_dir/Lib二、方法2: 多文件模块,带setup.py下载模块包,进行解压,进入模块文件夹,执行:python setup.py install三、 方法3:easy_install 方式先下载ez_setup.py,运行python e...
阅读全文
摘要:下述使用myDecorator的__call__方法替换aFunction:class myDecorator(object):def __init__(self, f):print("inside myDecorator.__init__()")f() # Prove that function ...
阅读全文