
Python
iteye_1617
这个作者很懒,什么都没留下…
展开
-
Python 中 数组套字典的排序
dict = [ {'id':'4','name':'b'}, {'id':'6','name':'c'}, {'id':'3','name':'a'}, {'id':'1','name':'g'}, {'id':'8','nam...原创 2011-07-06 11:54:52 · 2008 阅读 · 0 评论 -
Python 读取日志文件在前端实现分页查询
# -*- coding: utf-8 -*-import fileinputfilePath = 'd:/test.txt'page_size = 5 #每页显示的行数page_num = 1 #前端的当前页数current_num = 0 #从当前行数开始读取record_count = 0 ...原创 2011-12-03 15:59:13 · 437 阅读 · 0 评论 -
Python 递归遍历目录结构
Python 递归遍历目录结构 Author:lvmingyanEmail:lvmingyan86@yeah.net def list_dir(path, res): ''' res = {'dir':'root', 'child_dirs' : [] , 'files' : []} print list_dir('/r...原创 2011-11-14 19:41:56 · 356 阅读 · 0 评论 -
Python生成PDF
1、pyPdf:http://pybrary.net/pyPdf/ 2、reportlab:http://www.reportlab.com/software/opensource/原创 2011-03-15 09:27:37 · 210 阅读 · 0 评论 -
基于Aptana3+Django开发blog的示例
转自:http://www.cnblogs.com/meteoric_cry/archive/2011/08/16/2140046.html基于Aptana3+Django开发blog的示例开发环境:Win XP、Python26、Django1.1 前期需要准备的环境:安装好Python、Django(需要将Scripts目录添加至系统变量中)1、建立...原创 2011-12-12 15:49:35 · 164 阅读 · 0 评论 -
Python实用技巧-成为Pythoner必经之路
转自:http://www.iteye.com/magazines/12-Python前言 本文主要记录 Python 中一些常用技巧,所描述的是告诉你怎么写才是更好? 如果你并不熟悉Python语法,希望你能在下面代码片段中看到Python的简单、优雅; 如果你象我这样,对 Python 有兴趣或并正在学习,我相信下面的技巧并不会让你失望; 如果你已经是一名 Pythoner ,那...原创 2011-12-10 16:07:58 · 108 阅读 · 0 评论 -
django上传文件
转自:http://www.cnblogs.com/yijun-boxing/archive/2011/04/18/2020155.htmltemplate html(模板文件):<form enctype="multipart/form-data" method="POST" action="/address/upload/"><input type="file" ...原创 2011-08-16 16:41:11 · 127 阅读 · 0 评论 -
Python 去掉字符串两边的空格
需求:需要过滤掉输入字符串的前导,后续空格或其它字符.这在处理用户输入的时候比较有用.讨论:和其它语言类似,Python也提供了lstrip,rstrip和strip方法,类似Delphi和C#的trim方法.用法:[code="Python"]>>> x = ' test '>>> print '|', x.lstrip( ), '|', x...原创 2010-10-25 17:03:35 · 1539 阅读 · 0 评论 -
python模块之hashlib: md5和sha算法
hashlib是个专门提供hash算法的库,现在里面包括md5, sha1, sha224, sha256, sha384, sha512,使用非常简单、方便。md5经常用来做用户密码的存储。而sha1则经常用作数字签名。下面看看代码吧:[code="python"]#-*- encoding:utf-8-*-import hashliba = "a test stri...原创 2010-10-25 16:25:38 · 228 阅读 · 0 评论 -
Django跨域问题的解决方案
response = HttpResponse(json.dumps(hash_list))#response = HttpResponse(json.dumps(hash_list),'application/**')response['Access-Control-Allow-Origin'] = '*'return response原创 2013-01-09 10:39:53 · 156 阅读 · 0 评论