import time def tm(*arg, **kwargs): def wrap_fun(fun): def wrap_arg(*arg, **kwargs): print time.time() fun(*arg, **kwargs) print time.time() return wr ...
分类:
其他好文 时间:
2016-07-29 19:06:32
阅读次数:
153
buffer中内容的decode 使用paramiko执行远程ssh命令返回后,如果用stdout读了返回的内容,对其进行解码时,会因为远端的系统语言字符集和本地不一致,导致EncodeErr错误。解决方法 def ssh_and_exec(ip,username,passwd,cmd): try:... ...
分类:
其他好文 时间:
2016-07-28 15:43:55
阅读次数:
122
def square_of_sum(L): sum=0; for i in L: sum+=i*i return sum print square_of_sum([1, 2, 3, 4, 5])print square_of_sum([-5, 0, 5, 15, 25]) ...
分类:
编程语言 时间:
2016-07-25 01:49:18
阅读次数:
248
大锅在做外卖,给我说能否统计出这半年点餐次数最多的10个顾客,我不知道APP本身是否有这个功能,想了下最近用selenium较多,就用selenium尝试下吧。 1 定义一个类,这里先描述需要的属性和方法,后面再依次具体分析: 1 class Order: 2 def __init__(self, ...
分类:
其他好文 时间:
2016-07-24 19:10:17
阅读次数:
306
Scala中的文件操作基本可以依赖于Java的实现,包括输入、输出流的使用。 object FileOps {def main(args: Array[String]) { val file = Source.fromFile("E:\\WangJialin.txt") for (line <- f ...
分类:
其他好文 时间:
2016-07-24 17:39:45
阅读次数:
174
ac code: #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; #define INF 1e9 #def ...
分类:
其他好文 时间:
2016-07-24 12:00:59
阅读次数:
125
trait Action { def doAction } trait TBeforeAfter extends Action { abstract override def doAction { println("Initialization") super.doAction println("D ...
分类:
其他好文 时间:
2016-07-24 00:33:05
阅读次数:
266
trait logger{ def log(msg : String)} //继承的第一个trait用extends关键字,其余的用with 连接 class ConcreteLogger extends logger with Cloneable{ override def log(msg : S ...
分类:
其他好文 时间:
2016-07-23 23:03:44
阅读次数:
207
一、进程 二、线程 1,使用Thread方法创建线程 #!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'zhoufeng' import threading import time def f1(arg): time.sleep(5 ...
分类:
编程语言 时间:
2016-07-23 21:01:48
阅读次数:
188
1.python中的类与对象 举例: 1 >>>class MyFirstTestClass: 2 3 class Spec="it is a test class" 4 5 def__init__(self,word): 6 7 print"say "+word 8 9 def hello(sel ...
分类:
编程语言 时间:
2016-07-23 18:12:57
阅读次数:
324