![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 72
songuooo
Make easy things easy & hard things possible.
展开
-
Python - Parser for command line options - argparse
2 argparse2.1 Start with an exampleThe following code is a Python program that takes a list of integers and produces either the sum or the max:prog.pyfrom argparse import (ArgumentParser, Fi原创 2012-12-22 15:09:26 · 2537 阅读 · 0 评论 -
Python - Parser for command line options - optparse
1 optparseLet's start with an example.parser.pyfrom optparse import OptionParserusage = "usage: %prog [options] arg1 arg2"version = "%prog 1.0"parser = OptionParser(usage = usage, version原创 2012-12-22 14:03:36 · 1923 阅读 · 0 评论 -
Static Methods, Class Methods, and Decorators
1 Using Static Methods and Class MethodsLet's start with an example:methods.pyclass MethodsTest: # Create an instance: obj = MethodsTest() def imeth(self, x): #原创 2012-12-24 17:08:08 · 640 阅读 · 0 评论 -
Jython & Python Examples
1 Format IntergerThe following module, formats.py, defines string formatting utilities for importers, but also checks its name to see if it is being run as a top-level script; if so, it tests and原创 2012-12-16 14:49:02 · 676 阅读 · 0 评论 -
Decorators and Functional Python
Decorators and Functional PythonDecorators are one of Python's great features. In addition to their intrinsic usefulness in the language, they also help us to think in an interesting way — a fun转载 2013-01-10 15:06:23 · 670 阅读 · 0 评论 -
About python encoding
文件开头编码注释:# -*- coding:utf-8 -*-原创 2013-05-23 10:25:17 · 812 阅读 · 0 评论 -
Apache and mod_wsgi on Ubuntu 12.10
TheWSGI specification provides a standard and efficient method fordynamic web applications to communicate with web servers. mod_wsgiprovides a method for simply deploying WSGI applications with Ap原创 2013-05-15 10:49:26 · 1015 阅读 · 0 评论 -
Python Decorators
1 Using Properties to Control Attribute Accessimport mathclass Circle(object): def __init__(self, radius): # property __radius is private self.__radius = radius @propert原创 2013-05-29 23:09:34 · 871 阅读 · 0 评论