URL 调度程序

对高质量的 WEB 应用程序来说, 有一个干净优雅的 URL 调度机制是至关重要的. Django 允许你根据需要设计 URLs ,没有任何框架层的限制.

不需要 .php 或 .cgi 扩展名, 也没有象 0,2097,1-1-1928,00 那样的丑陋东西.

参阅 WWW 的缔造者 Tim Berners-Lee 所写的 Cool URIs don’t change, 这篇文章的主题就是为什么 URL 应该是干净并且便于使用的.

Continue reading URL 调度程序 - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Django模板系统学习整理

Django模板系统——模板的继承 extends

include  逆向 extends

 

 一、定义基础模板,在html内容中定义多个block块,block由子模板引用同名block块,来决定是否替换这些部分
{% block title %}一些内容,这里可不填{% endblock %}
{% block content %}一些内容,这里可不填{% endblock %}
{% block footer %}一些内容,这里可不填{% endblock %}

这里 title content footer 不是变量,名字自定义

Continue reading Django模板系统学习整理 - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Run taobao API using GAE

为了学习GAE(google app engine), 我写了一个小例子.因为GAE使用了django,沿用了其网络框架中基本
概念MTV(Model-Template-view). 在例子中,我用的model数据来自taobao API, 可以参考上篇文章:
Try taobao open API in python

在上篇文章中,调用taobao API拿到了一些测试数据, 可以把这些数据保存在GAE的数据库中,然后在View上
显示出来.
Continue reading Run taobao API using GAE - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

开始Python — List和Tuple(3)

3、Tuple:不可变的Sequence

l         Tuple类似,不同的是Tuple不能被改变

l         当你用“,”分割各个值时,就创建了Tuple:

>>> 1, 2, 3

(1, 2, 3)

l         同样,你可以使用()来包括Tuple:

>>> (1, 2, 3)

(1, 2, 3)

l         只有一个元素的Tuple也必须包含“,”:

>>> 42

42

>>> 42,

(42,)

>>> (42,)

(42,)
Continue reading 开始Python — List和Tuple(3) - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

开始Python — Dictionary

1、Dictionary语法

l         Dictionary由key/value对(称为项目)组成,key和value之间用“:”分割,项目用“,”分割,所有项目用“{}”包括起来

>>> phonebook = {’Alice’: ‘2341′, ‘Beth’: ‘9102′, ‘Cecil’: ‘3258′}

l         Dictionary的key值必须唯一,否则后者会覆盖前者:

>>> phonebook = {’Alice’: ‘2341′, ‘Alice’: ‘9102′, ‘Cecil’: ‘3258′}

>>> phonebook

{’Alice’: ‘9102′, ‘Cecil’: ‘3258′}

l         使用dict()函数可以从Mapping(如其它的Dictionary)或key/value形式的Sequence创建Dictionary:

>>> items = [('name', 'Gumby'), ('age', 42)]

>>> d = dict(items)

>>> d

{’age’: 42, ‘name’: ‘Gumby’}

l         也可以用keyword参数来创建Dictionary:

>>> d = dict(name=’Gumby’, age=42)

>>> d

{’age’: 42, ‘name’: ‘Gumby’}

  Continue reading 开始Python — Dictionary - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Python programming- List extend() and append()

Blogpump中想在中添加一个嵌套的为其子项,但是调用发现总是结果不对,才发现原来的调用有如此的差别。

1. (扩展) 与 (追加) 的差别
>>>li=['a','b']
>>>li.(['c','d'])
>>>li
['a', 'b', 'c', 'd']
>>>li.(['e','f'])
>>>li
['a', 'b', 'c', 'd',['e','f']]

Continue reading Python programming- List extend() and append() - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Python用SGMLParser抓取网页连接的改进

grove_SGMLParser 在网上看见用抓取网页连接的大部分都是用以下代码:
#!/usr/bin/env
# -*- coding: utf-8 -*-
from sgmllib import
import urllib
import
import socket
socket.setdefaulttimeout(210)

class URLLister():

Continue reading Python用SGMLParser抓取网页连接的改进 - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Core Python Programming(1) - Basic

core python programming 核心编程-读书笔记1

语句中有一些基本规则和特殊字符:
1 井号(#)表示之后的字符为 注释
2 换行 (\n) 是标准的行分隔符(通常一个语句一行)
3 反斜线 ( \ ) 继续上一行
4 分号 ( ; )将两个语句连接在一行中
5 冒号 ( : ) 将代码块的头和体分开
6 语句(代码块)用缩进块的方式体现
7 不同的缩进深度分隔不同的代码块
8 文件以模块的形式组织

Continue reading Core Python Programming(1) - Basic - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Eclipse SDK + PyDev = Python IDE

eclipse_logo 一直不太喜欢的庞大,但是现在也不能容忍IDLE的脆弱,还是尝试使用前者加来开发程序,参考了网上的一些文章基本上在一个小时之内完成了从0到环境的搭建和配置,并且成功的运行了以前的一个项目。以下链接和相关说明供参考。

安装配置Django开发环境( +

Continue reading Eclipse SDK + PyDev = Python IDE - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis
 Page 6 of 7  « First  ... « 3  4  5  6  7 »

Contact us

Admin: Bryan Wu