码迷,mamicode.com
首页 >  
搜索关键字:def    ( 28626个结果
python访问MS SqlServer(通过pyodbc)
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 5 import pyodbc 6 7 8 class MSSQL: 9 """10 封装pyodbc11 """12 13 def __init__...
分类:数据库   时间:2015-01-13 10:14:53    阅读次数:218
Scala bite by bite ---- 详解 :: 操作符
packagech2 /** *CreatedbyBoon2015/1/12. */ objectTestextendsApp{ vallist=List(1,2,3) vallist2=0::list//Thisisanoperator(ormethod)ofclassList::,所有以:结尾的操作符都是右结合的 } /* def::[B>:A](x:B):List[B]= newscala.collection.immutable.::(x,this) :..
分类:其他好文   时间:2015-01-13 01:34:53    阅读次数:170
使用装饰器时带括号与不带括号的区别
之前我们在一个用于统计函数调用消耗时间的装饰器中写了一个装饰器,用于统计函数调用时间。代码如下: from time import time from time import sleep def count_time(): def tmp(func): def wrapped(*args, **ka...
分类:其他好文   时间:2015-01-12 22:20:50    阅读次数:196
Python中threading.local方法
#coding=utf-8 import threading # 创建全局ThreadLocal对象: localVal = threading.local() localVal.val = "Main-Thread" def process_student(): print '%s (in %s)' % (localVal.val, threading.current_thread()....
分类:编程语言   时间:2015-01-12 16:29:12    阅读次数:363
Python操作MySQL
# coding=utf-import MySQLdb#查询数量 def Count(cur):count=cur.execute( 'select * from Student' )print 'there has %s rows record' % count#插入 def Insert(cur...
分类:数据库   时间:2015-01-12 14:22:58    阅读次数:160
Sublime Text 快捷键使用
Sublime Text 2包含了大量快捷操作,而且还很方便修改和追加自己喜欢的快捷键。查看快捷键的方式也很简单:------------------------------------------------------- 点击菜单栏:Preferences->Key Bindings –Def....
分类:其他好文   时间:2015-01-12 12:50:43    阅读次数:134
Python菜鸟晋级07----闭包
介绍         '@'符号用作函数修饰符是python2.4新增加的功能,修饰符必须出现在函数定义前一行,不允许和函数定义在同一行。也就是说@A def f(): 是非法的。只可以在模块或类定义层内对函数进行修饰,不允许修修饰一个类。一个修饰符就是一个函数,它将被修饰的函数做为参数,并返回修饰后的同名函数或其它可调用的东西。 @dec2 @dec1 def func(ar...
分类:编程语言   时间:2015-01-12 09:23:48    阅读次数:161
ruby学习之Hash
一、定义: hsh=Hash.new hsh=Hash[1=>”a”,2=>”b”] hsh={“1”=>”a”,2=>”b”} 支持任意对象为key,习惯使用Symbol   二、常用方法 #!/usr/bin/ruby def printResult(args)     print args     puts ""...
分类:其他好文   时间:2015-01-12 06:48:43    阅读次数:141
Scala:Functions and Closures
1 object Functions { 2 def main(args: Array[String]) { 3 // 本地函数 4 def localFun(msg: String) = println(msg) 5 localFun("Hi") 6 7 /...
分类:其他好文   时间:2015-01-11 20:20:48    阅读次数:253
python基础-3
python函数:def functionname( parameters ): "函数_文档字符串" function_suite return [expression]所有参数(自变量)在Python里都是按引用传递。如果你在函数里修改了参数,那么在调用这个函数的函数里,原始的参数也...
分类:编程语言   时间:2015-01-11 17:42:06    阅读次数:221
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!