码迷,mamicode.com
首页 >  
搜索关键字:def    ( 28626个结果
web-project 故障查看功能 检测是否启动fmd服务
def check_fmd_service(): try: output = subprocess.check_output('svcs -H -o state fmd',shell=True) state = output.decode('UTF-8').stri...
分类:Web程序   时间:2014-07-10 13:30:04    阅读次数:246
类的继承---多重继承(两个父类有相同方法名和参数)
1 # -*-coding:gb2312-*- 2 3 #Function:测试一下多继承 4 5 class A: 6 7 def F1(self): 8 print '调用A.F1()' 9 10 def F2(self):11 ...
分类:其他好文   时间:2014-07-10 00:38:31    阅读次数:367
rails [error_messages_for]
class Foo 255end def create @foo =Foo.new(params[:foo]) @foo.project_id =@project.id if @foo.save flash[:notice] = l(:notice_successfu...
分类:其他好文   时间:2014-07-07 18:21:22    阅读次数:240
LeetCode-Sort List(Python)
【问题】 Sort a linked list in O(n log n) time using constant space complexity. 【代码】 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # ...
分类:编程语言   时间:2014-06-28 08:29:23    阅读次数:222
LeetCode-Insertion Sort List (Python)
【问题】 Sort a linked list using insertion sort. 【代码】 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Sol...
分类:编程语言   时间:2014-06-28 07:55:49    阅读次数:199
#define中的rettype和##
# define DEF(func, kind, rettype, args...) rettype tern_ ## func (unsigned insid, ##args); 上面的rettype是宏参数,在实际使用DEF宏时,在rettype位置要有一个参数,然后在宏内容里rettype位置就会被替换为你提供的参数;##用于连接前后两个参数,把它们变成一个字符串。 DEF(...
分类:其他好文   时间:2014-06-28 07:15:10    阅读次数:1352
Python
1、类、子类与函数定义: class Animal(object): # object 继承object类。 Paw=True Age=1 def Eat(self,a): print(a)class Tiger(Animal): # object 继承Animal类...
分类:编程语言   时间:2014-06-27 20:17:22    阅读次数:193
Python基于比较的排序
排序是算法学习中最基本的问题。1.平均时间复杂度均为O(N2)的排序1.1 插入排序插入排序对少量元素的排序非常有效。工作机制就像打牌一样,为了将牌插入到已排好序的牌中,需要将牌与手中的牌从右向左进行比较。def insertionSort(alist): n=len(alist) fo...
分类:编程语言   时间:2014-06-27 12:07:54    阅读次数:338
Python url_escape
escape.py# -*- coding: utf8 -*-import sysif type('') is not type(b''): def u(s): return s bytes_type = bytes unicode_type = str bas...
分类:编程语言   时间:2014-06-27 11:10:20    阅读次数:480
ruby简单的基础 6
模块模块同类一样,也有 class method 和 instance method。module 没有new不能生成实例对象其中 class method 在模块中称为模块方法,是可以直接调用的。module Foo def self.hello puts 'hello world!' end def Foo.dear #module全局作用域内的self还是没有变,就是...
分类:其他好文   时间:2014-06-26 14:19:28    阅读次数:163
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!