原创 python記錄日誌

#-*-coding:utf-8-*- #__author:martin #date:2017/10/9 import logging import sys #獲取logger實例,如果參數爲空則返回root logge

原创 python 利用正則實現簡易計算器

#-*-coding:utf-8-*- #__author:martin #date:2017/10/11 import re def f_string(s): s = s.replace(' ','') s =

原创 python 使用json模塊

#-*-coding:utf-8-*- #__author:martin #date:2017/10/14 import json # dic = {'name':'martin','age':20} # data = jso

原创 Zookeeper以Windows服務安裝運行

Zookeeper以Windows服務安裝運行 2016-04-01 18:20 by mrluo735, 2454 閱讀, 6 評論, 收藏, 編輯 1.下載的Zookeeper是.cmd的批處理命令運行的,默認沒有提

原创 phaser模擬百米賽跑

package com.brendan.cn.concurrent.match; import java.util.concurrent.Phaser; public class Match { // 模擬了100米

原创 python 中的正則

匹配數字 \d,字符符號\w,空白符號\s,特殊邊界\b # ret = re.findall('\d+','12344eee') # print(ret) # ret = re.findall('\smart',' ad ma

原创 python 裏裝飾器

裝飾器就是給原理的函數添加新的功能,用到了閉包 #需要添加的功能 def show_time(fun): def inner(): start = time.time() fun()

原创 synchronous錯誤使用

i++後對象變化了,所以會出現錯誤的結果。 package com.brendan.cn.concurrent; import java.net.InetAddress; /**************************

原创 python變量賦值

1、python 的安裝目錄 D:\development\Python36 2、 將D:\development\Python36 加入到環境變量path ,查看版本 3、在E:\python文件夾裏新建一個test

原创 java中創建線程的兩種方式

package com.brendan.cn.concurrent; public class TestThread { public static void main(String[] args) {

原创 python 面向對象繼承

#-*-coding:utf-8-*- #__author:martin #date:2017/10/15 class F: def f1(self): print('F.f1') class S(

原创 python打印乘法表

i = 1 while i <= 9: j = 1 while j <= i : print(j ,"*", i , "=" , j*i,end="\t") j += 1

原创 python 打印1-100所有的奇數

for i in range(1,101): if i % 2 == 1: print(i)

原创 python 內置函數

#filter def fun1(s): if s != 'a': return s str = ['a','b','c','d'] f1 = filter(fun1 , str) print(list(

原创 python 淺copy 和 深copy

淺copy 只copy第一層 第一種情況 s = [‘martin’,’decoration’,123] s1 = s.copy() s1[0]= ‘s’ print(s1) print(s) [’s’, ‘dec