Time of Update: 2015-07-05
標籤:1/cmd命令下python開發模式退出方式:Ctrl+z2/自然字串 在字串前加r,例如r"hello/n",可以保留轉義符3/字串重複 *n4/子字串:索引,切片5、集合:建立關係(&交集,|並集,-差集),去除重複元素6、pickle醃制 目的:將資料在序列化,儲存在記憶體中,在本地實現持久化
Time of Update: 2015-07-03
標籤:dict list pythonPython內建了字典:dict的支援,dict全稱dictionary,在其他語言中也稱為map,使用鍵-值(key-value)儲存,具有極快的尋找速度通過help(dict)可以尋找dict有關的函數操作例如: dt = dict(name=‘test‘, age=20, score=90) 特別注意:1、dict內部存放的順序和key放入的順序是沒有關係的。
Time of Update: 2015-07-03
標籤:sorted()是Python內建的一個高階函數,可以實現對list的排序,它還可以接收一個比較函數來實現自訂的排序。現在有一個list : [36, 5, 12, 9, 21]我們分別對這個list進行如下操作:1、對list進行排序,使用sorted直接排序即可:print sorted([36, 5, 12, 9, 21])2、對list進行倒序排序,可以自定一個方法:def reversed_cmp(x, y): if x > y: return -1
Time of Update: 2015-07-03
標籤:python 學習筆記 變數:用於引用(綁定)對象的標識符文法:》》變數名=對象 (數值,運算式等)如計算圓的面積PI=3.14redius:12.3area=PI*radius**2(**在python中表示平方)radius:23.4print area增量賦值運算子,基本文法和C/C++一樣標識符:變數,函數,模組等的名字命名規則:》》可以任意長》》包含數字和字母,底線》》
Time of Update: 2015-07-02
標籤:continue file python #!/usr/bin/pythona = "a.txt"f = file(a)c = f.readlines()while True: user_input = ra
Time of Update: 2015-07-03
標籤:參考筆記 蟲師 http://www.cnblogs.com/fnng/p/3576154.html #自動訪某個網址from selenium import webdriverimport timeM = 100000 i = 0URL = ‘http://www.yyxxww.com/html/2015/edu_0318/3386.html‘browser = webdriver.Firefox() #瀏覽器名字,以本機安裝為準while i < M:
Time of Update: 2015-07-01
標籤:vs2013 opencv python 影像處理 快樂蝦http://blog.csdn.net/lights_joy/歡迎轉載,但請保留作者資訊BRISK是BRIEF描述子的一種改進,相比於BRIEF特徵,它具有旋轉不變性、尺度不變性和對雜訊的魯棒性。本節嘗試在python下使用此特徵檢測方式,使用的測試映像為先前已經轉換為灰階圖的棉花映像:首先讀取映
Time of Update: 2015-07-02
標籤:轉載自 http://oursimplehouse.blog.sohu.com/63588732.html安裝 memcached:1、下載memcached-1.2.2.tar.gz2、tar xvzf memcached-1.2.2.tar.gz3、./configure;make;make install安裝python API組件:1、下載python-memcached-1.39.tar.gz2、tar xvzf
Time of Update: 2015-07-01
標籤:基礎知識:概述資料類型運算子語句1.概述 省略2.資料類型 5個標準資料類型: Numbers (數字) String (字串) List (列表 []) Tuple (元組 ()) Dictionary (字典 {}) Numbers用於儲存數值,是不可變資料類型,改變數字資料類型會分配一個新的對象。Python支援四種數實值型別:int (有符號整型) long (長整型[也可以代表八進位和十六進位]
Time of Update: 2015-07-01
標籤:python 檔案
Time of Update: 2015-07-01
標籤:1.自然語言工具包(NLTK)NLTK 建立於2001 年,最初是賓州大學電腦與資訊科學系計算語言學課程的一部分。從那以後,在數十名貢獻者的協助下不斷髮展壯大。如今,它已被幾十所大學的課程所採納,並作為許多研究項目的基礎。表P -2 列出了NLTK
Time of Update: 2015-07-01
標籤:官網文檔的例子 1 from multiprocessing import Process, Value, Array 2 3 def f(n, a): 4 n.value = 3.1415927 5 for i in range(len(a)): 6 a[i] = -a[i] 7 8 if __name__ == ‘__main__‘: 9 num = Value(‘d‘, 0.0)10 arr = Array(‘i‘, range(1
Time of Update: 2015-07-01
標籤:測試版本:Python 2.7 Django 1.6.2 models.pyfrom django.db import modelsclass Article(models.Model): title = models.CharField(u‘文章標題‘, max_length=120, blank=True) summary = models.CharField(u‘文章摘要‘, max_length=255,
Time of Update: 2015-07-01
標籤:普通的方法,第一個參數需要是self,它表示一個具體的執行個體本身。如果用了staticmethod,那麼就可以無視這個self,而將這個方法當成一個普通的函數使用。而對於classmethod,它的第一個參數不是self,是cls,它表示這個類本身。>>> class A(object): def test1(self): print "Hello",self @staticmethod def test2():
Time of Update: 2015-07-01
標籤:http://www.cnblogs.com/linjiqin/p/4228896.htmlenumerate函數用於遍曆序列中的元素以及它們的下標i = 0seq = [‘one‘, ‘two‘, ‘three‘]for element in seq: print i, seq[i] i += 1#0 one#1 two#2 threeprint ‘============‘seq = [‘one‘, ‘two‘, ‘three‘]for i, element in
Time of Update: 2015-07-01
標籤:一、方法1: 單檔案模組直接把檔案拷貝到 $python_dir/Lib二、方法2: 多檔案模組,帶setup.py下載模組包,進行解壓,進入模組檔案夾,執行:python setup.py install三、 方法3:easy_install 方式 先下載ez_setup.py,運行python ez_setup 進行easy_install工具的安裝,之後就可以使用easy_install進行安裝package了。 easy_install
Time of Update: 2015-07-01
標籤:#接受裝飾器的參數def deco_arg(deco_arg): #接受函數 此列為func1 def deco_func(*argv,**kwag): #接受函數的方法 此列為 a b def _deco_func(*argv,**kwarg):
Time of Update: 2015-07-01
標籤:#!/usr/bin/env python#_*_coding=utf-8_*_#Author: xieyixue#mail: [email protected]#Created Time: 2015年07月01日 星期三 01時30分36秒class staticClass: def __init__(self): print "初始化" @staticmethod def before(): print "before"
Time of Update: 2015-06-29
標籤:寫這篇日誌的目的,只是記錄一下學習Python的一些問題,收穫。今天,也是新入職第一天,也記錄下日常生活的點滴。看看我能堅持多久吧。 早上,起床,洗漱,急忙趕往公司,結果還是遲到了,但是老闆不在,然後就是裝機,裝機的過程中知道了公司早上上班時間很靈活,從8點半到9點半都可以,只是影響你下班的時間,心中暗爽。但是遲到一次扣50,還是有點嚇人的。然後開始一天的扯淡。下午5點半準時溜。 回來開始安裝Python(本來昨晚上就在下的,可是弄了半天,
Time of Update: 2015-07-01
compute the su procedure time with python,computepython#!/usr/bin/python2.6import re,datetimefile_name='sim.log'file=open(file_name,'r')acnum=[];time_res=[];lnum=0def trans_time(time): t1=datetime.datetime.strptime(time,'%y/%m/%d %H:%M:%