码迷,mamicode.com
首页 >  
搜索关键字:def    ( 28626个结果
spark rddToPairRDDFunctions countByKey
package com.latrobe.spark import org.apache.spark.{SparkContext, SparkConf} /** * Created by spark on 15-1-18. * 计算出每个key对应的value的数量 */ object CountByKey { def main(args: Array[String]) { v...
分类:其他好文   时间:2015-01-18 15:48:22    阅读次数:251
django中间件templates写法
def templates_context_process(request): from django.contrib.sites.models import Site from accounts.models import ContactUsInfo if Site.object...
分类:其他好文   时间:2015-01-18 15:33:01    阅读次数:173
类和对象---Python
构造类:class people(object): name=""----属性 age=0 __weight=0----属性前加”--“表示私有属性,不可用于外部访问 def __init__(self,n,a,w):---构造函数 self.name=n self.age=a self.__wei...
分类:编程语言   时间:2015-01-18 10:32:34    阅读次数:143
[LeetCode] Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree. 1 /** 2 * Def....
分类:其他好文   时间:2015-01-17 16:29:31    阅读次数:160
python判断unicode是否是汉字,数字,英文,或者其他字符
下面这个小工具包含了 判断unicode是否是汉字,数字,英文,或者其他字符。 全角符号转半角符号。 unicode字符串归一化等工作。   #!/usr/bin/env python # -*- coding:GBK -*-    """汉字处理的工具: 判断unicode是否是汉字,数字,英文,或者其他字符。 全角符号转半角符号。""" def ...
分类:编程语言   时间:2015-01-17 15:15:16    阅读次数:180
Letter Combinations of a Phone Number
class Solution {public: vector result; vector letterCombinations(string digits) { string buf[] = { "abc","def","ghi","jkl","mno","pqrs","tuv...
分类:其他好文   时间:2015-01-17 11:08:41    阅读次数:195
隐马尔可夫模型学习小记——forward算法
首先是forward算法的Python实现:#-*-coding:utf-8-*-__author__ = 'ZhangHe'def forward(N,M,A,B,P,observed): p = 0.0 #观察到的状态数目 LEN = len(observed) #中间概...
分类:编程语言   时间:2015-01-16 23:43:13    阅读次数:295
Spring3.1前后 拦截器与Json转换的区别
Spring 3.0.x中使用了annotation-driven后,缺省使用DefaultAnnotationHandlerMapping 来注册handler method和request的mapping关系。 AnnotationMethodHandlerAdapter来在实际调用handlermethod前对其参数进行处理。  在spring mvc 3.1中,对应变更为  Def...
分类:编程语言   时间:2015-01-16 19:14:54    阅读次数:822
python分析日志脚本
1 #!/usr/bin/env python 2 # coding:utf-8 3 4 import sys,time 5 6 class DisplayFormat(object): 7 8 def format_size(self,size): 9 ...
分类:编程语言   时间:2015-01-16 16:13:26    阅读次数:251
jython语言学习笔记
1.变量可以随便定义,不限制类型,不限制数值。开头空4个空格,使用def定义函数,可以嵌套,可以传参。2.每个语句结束的时候没有分号。定义类的时候没有括号。在print语句的后面有格式转换时要加上% , for和while之后要加冒号,快捷键被我改成了CTRL+R 和DMethodDescripti...
分类:编程语言   时间:2015-01-16 11:19:24    阅读次数:214
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!