
python
文章平均质量分 62
小桥
活泼开朗 ,乐于帮助他人
展开
-
实例讲解hadoop中的map/reduce查询(python语言实现)
条件,假设你已经装好了hadoop集群,配好了hdfs并可以正常运行。 $hadoop dfs -ls /data/dw/explorer Found 1 items drwxrwxrwx - rsync supergroup 0 2011-11-30 01:06 /data/dw/explorer/20111129 $转载 2013-07-10 10:55:53 · 1313 阅读 · 0 评论 -
Django 学习
我的应用很简单。我只需要读取指定日期的收益金额,并保存到我的本地数据库。 我在djaongo项目中创建了一个新的应用,叫做“adsense”。并创建了一个models.py文件来存储认证证书。 from django.contrib.auth.models import User from django.db import models from oauth2client.djang转载 2013-06-28 14:19:44 · 790 阅读 · 0 评论 -
Django startproject的问题
下载 python-2.7.2.msi http://www.python.org/getit/ Django-1.3.1.tar.gz https://www.djangoproject.com/ Django暂时只支持python 2.4 ~ 2.7, 在Django-1.3.1\docs\intro\install.txt中有说明: Being a Python Web fra转载 2013-06-27 11:02:01 · 1913 阅读 · 0 评论 -
python 条件,循环和其他语句
条件,循环和其他语句 print 输出多个用 逗号隔开 >>> print 'hello','world',' !' hello world ! -------------------------------------------- 为函数提供别名 >>> import math as qiao >>> qiao.sqrt(9) 3.0 >>> from math impor原创 2013-06-26 18:28:46 · 822 阅读 · 0 评论 -
python 字典
python dictionary 字典由对个键以及与其对应的值构成 可以如下创建: >>> phonebook={'qiao':'119','lisi':'101','zhaowo':'787'} dict函数 >>> items = [('name','qiaoc'),('age',26)] >>> d=dict(items) >>> d {'age': 26, 'name':原创 2013-06-26 11:01:42 · 764 阅读 · 0 评论 -
python 抽象
抽象 创建函数 >>> def hello(name): return 'hello,'+name+'!' >>> hello('qiaochao') 'hello,qiaochao!' 函数注释 1)以#开头 2)直接写上字符串 函数定义可以嵌套 >>> def foo(): def bar(): print 'hello aaa ' bar() >>原创 2013-06-26 18:26:45 · 704 阅读 · 0 评论 -
python 字符串
python 字符串 注意:字符串都是不可变的 >>> web = 'http://www.baidu.org' >>> web[-3:] 'org' >>> web[-3:]='com' Traceback (most recent call last): File "", line 1, in web[-3:]='com' TypeError: 'str' o原创 2013-06-25 17:19:31 · 859 阅读 · 0 评论 -
python 基础知识(字符串 序列)(2)
列表方法: 1. append 方法 >>> lst = [1,2,3] >>> lst.append(4) >>> lst [1, 2, 3, 4] >>> xc=lst.append(5) >>> xc >>> print xc None >>> lst [1, 2, 3, 4, 5] >>> xc=lst >>> xc [1, 2, 3, 4, 5] app原创 2013-06-25 11:37:53 · 773 阅读 · 0 评论 -
python 基础知识(字符串 序列)(1)
============================================================================= 用import 导入模块 要安装 “模块。函数” 的格式来使用函数 例如: >>>import math >>>math.floor(32.9) 32 在使用“from 模块 import 函数” 这种形式的import命令后原创 2013-06-25 10:30:20 · 1235 阅读 · 0 评论 -
python 学习笔记一
初级阶段 (简单实践) tmp_storage = "" welcome = "hello!" tmp_storage = welcome print tmp_storage 结果:hello! ------------------------------------------------- radius = 10 pi = 3.14 area = pi*radius**原创 2013-06-25 10:28:23 · 828 阅读 · 0 评论 -
linux上编译安装python2.7.5
1. 下载python2.7.5,保存到 /data/qtongmon/software http://www.python.org/ftp/python/ 2. 解压文件 tar xvf Python-2.7.5.tar.bz2 3. 创建安装目录 mkdir /usr/local/python27 4. 安装python ./configure --prefix=/usr/loc原创 2014-03-25 20:23:47 · 1644 阅读 · 0 评论