文章分类 -  python

django开发流程以及数据库的测试问题
摘要:数据库的配置问题:1配置:(使用mysql 的情况下)配置setting 时一定注意的是 DATABASE中的name 其中的NAME blog 对应的名字为blog 的数据库DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'blog' 阅读全文

posted @ 2013-08-21 16:42 Practicer.. 阅读(181) 评论(0) 推荐(0)

Learn to Program: Crafting Quality Code
摘要:第一件:关于palindrome编写函数应该注意的是对于函数的解释参数->返回值例子def reverse(s): '''(str)->str //参数以及放回值 Return a reversed version if s //描述 >>>reverse('hello')//例子 'olleh' >>reverse('a')//特殊例子 'a' ''' rev=''#for for ch in s: rev=ch +rev 阅读全文

posted @ 2013-04-15 22:36 Practicer.. 阅读(140) 评论(0) 推荐(0)

pythin 字符编码
摘要:字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。decode的作用是将其他编码的字符串转换成unicode编码,如str1.decode('gbk'),表示将gb2312编码的字符串str1转换成unicode编码。encode的作用是将unicode编码转换成其他编码的字符串,如str2.encode('gbk'),表示将unicode编码的字符串str2转换成gb2312编码http: 阅读全文

posted @ 2013-03-27 08:51 Practicer.. 阅读(408) 评论(0) 推荐(0)

python词典的小例子
摘要:#!/usr/bin/python 2 #coding=UTF-8 3 #这是利用的有道的词典完成的词汇的查询 4 import sys 5 import urllib 6 import urllib2 7 def search(word): 8 main_link='http://dict.youdao.com/search?le=eng&q=' 9 l_link='&keyfrom=dict.index' 10 11 t_link=main_li... 阅读全文

posted @ 2013-03-27 08:25 Practicer.. 阅读(191) 评论(0) 推荐(0)

导航