Time of Update: 2014-07-26
標籤:mysql db CentOS下安裝sudo yum install MySQL-python可以參考http://www.mikusa.com/python-mysql-docs/index.html 擷取更多資訊MySQL-python
Time of Update: 2014-08-11
標籤:http ar div python ef on sp blank 為了裝個matplotlib包,搞了好久; python3.4,官方沒有對應版本的包,只能去下面這個地方下對應的版本:http://www.lf
Time of Update: 2014-08-11
標籤:style blog color 使用 os io ar div 最近遇到一個需求,需要通過shell調用python中的一個函數,發現其實也挺簡單的:python指令碼如下:test.py: import
Time of Update: 2014-08-11
標籤:des style blog http os io strong 資料 NumPy作為python科學計算的基礎,為何python適合進行數學計算,除了簡單易懂,容易學習
Time of Update: 2014-08-11
標籤:blog ar div 工作 log python 學習 ef 在學習python的過程中很多時候都需要用到re(正則),因為我也不是開發所以呢只是簡單說一下經常需要用到的東西。 在工作中經常用到的主要是三個函數:1
Time of Update: 2014-08-11
標籤:http 使用 os io strong 檔案 資料 for 簡單介紹一下edwin edwin是一個警示和監控平台, 可以使用它監控任意東西, 如有異常(分為警告級和嚴重級), 可以發出警示. 可以自訂警示的通知方式,
Time of Update: 2014-08-11
標籤:blog 使用 strong for ar div 代碼 amp 所謂單例,是指一個類的執行個體從始至終只能被建立一次。方法1如果想使得某個類從始至終最多隻有一個執行個體,使用__new__方法會很簡單。Python中類是
Time of Update: 2014-08-11
標籤:excel python xlrd 有個excle表格需要做一些過濾然後寫入資料庫中,但是日期類型的cell取出來是個數字,於是查詢了下解決的辦法。基本的代碼結構data = xlrd.open_workbook(EXCEL_PATH)table = data.sheet_by_index(0)lines = table.nrowscols =
Time of Update: 2014-08-10
標籤:如何問題: 1. Python數值有哪些? 2. 各類型的精度是多少? 3. 類型的轉換是如何?的? 5. 如何使用這些資料類型?需要注意什嗎? 6. 什麼是不可變類型? 數實值型別: 整型: (不可變類型) 標準整型:取值範圍[-sys.maxint-1, sys.maxint]
Time of Update: 2014-07-30
python中的裝飾器python中的裝飾器可以裝飾函數,也可以裝飾類,功能是向函數或者類添加一些功能。類似於設計模式中的裝飾模式,它可以把裝飾器的功能實現部分和裝飾部分分開,避免類中或者函數中冗餘的代碼。裝飾器裝飾函數:def decrator(f1):def newf():print "strings will be connected:"print f1();return newf;@decratordef strconnect():x=raw_input("
Time of Update: 2014-07-15
centos7.0
Time of Update: 2014-07-07
一個同步zookeeper節點的python指令碼因zk的寫效能不高,為了不讓監控上報類的服務影響現網服務,我們把zk叢集分離開。而有個上報接入agent需要在兩個不同zk叢集中註冊節點,架構只支援一個zk叢集,修改還需下個版本。臨時寫了個指令碼完成節點同步:#!/usr/bin/env python#coding=utf-8import logginglogging.basicConfig()from kazoo.client import KazooClientdef
Time of Update: 2014-06-26
利用python開發了一個提取sim.log 中的各個關鍵步驟中的時間並進行統計的程式:#!/usr/bin/python2.6import re,datetimefile_name='/home/alzhong/logs/qtat1/R2860.01.13/sim-applycommitrollback-bld1.log'file=open(file_name,'r')acnum=[];time_res=[];lnum=0def trans_time(time)
Time of Update: 2014-06-14
溫馨提示:閱讀本文的同學最好能瞭解makefile和python的編寫規則。不懂的同學可以先儲存在收藏夾,以便日後查看。轉載請以超連結標明:http://www.guimigame.com/thread-460-1-1.html其實之前我一直很懶,我不想瞭解makefile規則,因為在linux下開發我一直使用Qt creator。(很多時候正是一些“懶人”的創造力,解放了我們的雙手,顯然現在我們還需要用雙手寫makefile)。Qt
Time of Update: 2014-05-24
同樣的程式在WIN下跑正常,在Linux下跑讀取個別檔案會提示“UnicodeDecodeError: 'gbk' codec can't decode bytes in position 30664-30665: illegal multibyte
Time of Update: 2014-05-21
python中使用Regex1. 匹配字元Regex中的元字元有 . ^ $ * + ? { } [ ] \ | ( )匹配字元用的模式有\d 匹配任一數字 \D 匹配任意非數字\s 匹配任意空白字元\S 匹配任意非空格字元 \w 匹配任一數字或者字母\W 匹配任意非數字或者字母 2. Regexpython中使用compile處理Regex,如:import re;p=re.compile(‘[a-c]’);p.match(s);s是待匹配的字串,
Time of Update: 2014-05-13
靜態方法獨立於類和類的執行個體,它是定義在類範圍內的方法。可以由類和執行個體直接調用。類方法和靜態方法都要使用裝飾器來定義,定義的基本格式是:@staticmethoddef <function name>():#do something類方法定義的基本格式是:@ classmethoddef <function name>(cls):#do something類方法與成員方法不同的是,它需要傳入參數cls,cls代表類。class
Time of Update: 2014-05-07
1.字串轉換s.lower() 轉為小寫s.upper() 轉為大寫s.swapcase() 大寫轉為小寫,小寫轉為大寫s.capitalize() 首字母大寫轉換為int類型 string.atoi(s) 或者int(s)轉換為float類型 string.atof(s) 或者float(s)轉換為long類型 string.atol(s) 或者long(s)2.尋找等操作s.find(sub,[,start[,end]]) 返回首次出現的位置,找不到返回-1s.
Time of Update: 2013-12-28
1.查看python的版本Java代碼 650) this.width=650;" class="star" src="http://www.bkjia.com/uploads/allimg/131228/00153H000-0.png" alt="收藏代碼" />[root@localhost ~]# python -V Python
Time of Update: 2013-12-28
server端#!/usr/bin/env pythonimport socketimport timehost=''port=99999s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)s.bind((host,port))s.listen(2)while 1:conn,addr = s.accept()#---------------print 'got connection from:',addrwhile 1:data = conn.