![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 74
hqmanwangkai
这个作者很懒,什么都没留下…
展开
-
ubuntu 7.10 Quixote 安装笔记
wget http://quixote.ca/releases/Quixote-2.5.tar.gz tar Quixote-2.5.tar.gz cd Quixote-2.5 python setup.py install 发生错误 error: command 'gcc' failed with exit status 1 找了半天这样可以搞定 apt-get inst...2008-10-04 16:41:06 · 61 阅读 · 0 评论 -
pythonic用法
python 语言 倡导 简单 简洁 优美 记录一些 Pythonic的用法 1:使用TAB 来缩进 2:交换2个元素值 a,b=b,a 3: list 元素 字符相加 list1=['a','b','c'] str1=''.join(list1) 4: 打开文件 with open('xxx.xx') as fp: ...原创 2011-11-04 14:36:28 · 169 阅读 · 0 评论 -
用pyexe把django应用打包成 windows上EXE可执行文件
续上文 把django应用 打包 发布成 可独立运行的桌面程序 1:下载必需的软件包 http://www.python.org/getit/releases/2.6/ https://www.djangoproject.com/download/ http://users.skynet.be/sbi/libxml-python/ http:/...原创 2011-10-29 16:22:51 · 1621 阅读 · 0 评论 -
把django应用 打包 发布成 可独立运行的桌面程序
把django应用 打包 发布成 可独立运行的桌面程序 需求:在pc上运行django+sqlite应用,无须安装django python 数据库 web服务器 。。。 传统django 应用运行在 apache or nginx fastcgi,偽了方便我们用cherrypy来作WEB服务器。 cx_freeze 跨平台的python 打包工具 步骤: ...原创 2011-10-26 23:20:07 · 1674 阅读 · 0 评论 -
Dropbox python开发中6点教训(每十五分钟同步100万个文件)
Dropbox saves one million files every 15 minutes, more tweets than even Twitterers tweet. That mind blowing statistic was revealed by Rian Hunter, a Dropbox Engineer, in his presentation How Drop...原创 2011-10-08 12:51:42 · 142 阅读 · 0 评论 -
python list 排序
对于简单的list排序,直接调用内建函数就可以了,但是对于dict的list排序就没有那么直接了,不过,还是有很简洁的办法的,如: >>> ls1 = [{'a' : 1, 'b' : 12}, {'a' : -1, 'b' : 22},{'a' : 12, 'b' : 32},{'a' : 6, 'b' : 42}] >>> ls1.sort(...原创 2010-10-06 21:16:40 · 119 阅读 · 0 评论 -
Standalone Django scripts
In the grand tradition of providing answers to frequently-asked questions from the django-users mailing list and the #django IRC channel, I’d like to tackle something that’s fast becoming the ...原创 2010-09-26 15:46:20 · 103 阅读 · 0 评论 -
python连mysql 数据库问题『 mysql 'latin-1' codec can't encode ch』
class MysqlPipeline(object): def process_item(self, item, spider): conn = MySQLdb.connect(host='localhost', user='root',passwd='') conn.set_character_set("utf8") ...原创 2010-09-25 17:11:09 · 116 阅读 · 0 评论 -
python项目包管理
最近学习django 进行web开发,在deploy程序是碰到一个问题: 服务器环境与本地开发环境不是完全一样, 在本地开发过程中安装一些python django 的第三方包如:PIL ,django-voting,debug-toolbar... 一大推。难道要在服务器上从来再pip install 一次吗? 想不到pip 提供了一个人性化的功能,导出现项目所有的依赖包: ...原创 2010-09-19 14:17:08 · 90 阅读 · 0 评论 -
python 领域中的模板引擎 转
GenShi 特点:解释型模板,纯粹面向 xml,流式的处理机制,能够嵌入 python 语句和表达式,提供强大的功能。 从 Kid 发展而来,比 Kid 更灵活,性能也更好,实现部分 XPath,XInclude 规范。 TurboGears 默认的模板引擎将从 Kid 转为 GenShi 。 MaKo 特 ...原创 2010-06-10 20:14:42 · 357 阅读 · 0 评论 -
ssh 自动登录服务器脚本
每次登录服务器 打很多字 好累,同事推荐了一个好东西。 # -*- coding: utf-8 -*- import os, sys, pexpect password = 'xxxxxxxxxx' p = pexpect.spawn("ssh xxxx@xxxxxxx") i = p.expect(".*assword:") j = p.sendline("xxxxxx"...2009-06-24 10:05:09 · 76 阅读 · 0 评论 -
Python-字符串操作方法
Python-String-Function 字符串中字符大小写的变换: * S.lower() #小写 * S.upper() #大写 * S.swapcase() #大小写互换 * S.capitalize() #首字母大写 * String.capwords(S) #这是模块中的方法。它把S用split()函数...原创 2009-01-14 14:05:19 · 93 阅读 · 0 评论 -
django通过gettext实现国际化
Python 通过 gettext 模块支持国际化 (i18n), 可以实现程序的多语言界面的支持 在用django开发当中碰到如下错误: django-admin.py compilemessages processing file django.po in /home/www/locale/zh_CN/LC_MESSAGES sh: msgfmt: not found 原来是没...2008-10-21 16:00:21 · 476 阅读 · 1 评论 -
lighttpd整合django(折腾了好几天终于搞定了)
折腾了好几天终于搞定了 lighttpd的设置如下 url.rewrite-once = ( "^(/media.*)$" => "$1", "^(/admin_media.*)$" => "$1", ( 这个地方容易犯错误,需要把django admin 的css link 到 项目目录下) "^(/.*)" =&g2008-10-15 12:31:19 · 298 阅读 · 0 评论 -
Gunicorn上跑pyramid
看到 Instagram他们用了这个服务器于是仔细看了一下,是prefork 多进程 WSGI http server. 使用非常简单 1: pip install pyramid gunicorn 2: paster create -t pyramid_alchemy 3: python setup.py develop 4 :...2011-12-08 20:48:40 · 211 阅读 · 0 评论