Time of Update: 2017-02-18
標籤:lis span 安裝 com code bsp 指令碼語言 log list 1.查看python安裝好的包版本資訊:pip
Time of Update: 2017-02-18
標籤:解析 render show 字典 play 處理 部分 user template Web架構本質眾所周知,對於所有的Web應用,本質上其實就是一個socket服務端,使用者的瀏覽器其實
Time of Update: 2017-02-19
標籤:python 日曆 輸出指定年月份的日曆,沒輸出一個月份間隔1s.#!/usr/bin/python#coding=utf-8import timeimport calendark=0def nowtime(): t1=time.time() localt1=time.localtime(t1)&nbs
Time of Update: 2017-02-18
標籤:python安裝 提高 方法 python指令碼 編譯 預設 檔案名稱 檔案 表示 一,python代碼執行的過程:代碼載入到記憶體中將記憶體中的代碼編譯成位元組碼將位元組碼編譯成機器碼二
Time of Update: 2017-02-17
標籤:function either receives python called Help on class classmethod in module __builtin__:class classmethod(object) | classmethod(function) ->
Time of Update: 2017-02-16
標籤:ted root ica else div state rac read split 1 #coding:utf-8 2 #!/usr/bin/python 3 from
Time of Update: 2017-02-16
標籤:imp print 返回 min cloc span code struct localtime 一、time模組1、time.sleep(5) #等待5秒鐘 #!
Time of Update: 2017-02-15
標籤:操作 結束 字串操作 pytho strip 截取 mat 字串 nbsp 1、兩種字串格式化字串%s 數字%d例子 name=‘i am %s ’%
Time of Update: 2017-02-15
標籤:父類 instance 匯入模組 收集器 定義類 ide tty div 概念 Python
Time of Update: 2017-02-16
函數式編程上學期有上一門叫 '人工智慧' 的課,老師強行要我們學了一個叫做 prolog 的語言,哇那感覺確實難受,思維方式完全和之前學過的不一樣,寫個漢諾塔想了半天,最後還是在網上找了段代碼修改一下(怕被老師發現抄襲)才寫出來,貼一段出來感受一下:hanoi(N) :- dohanoi(N, 'a', 'b', 'c').dohanoi(0, _ , _ , _ ) :- !.dohanoi(N, A, B, C) :
Time of Update: 2017-02-18
Python的魔術方法是Python中那些預定義的像__XXX__類型的函數。使用Python的魔術方法的最大優勢在於python提供了簡單的方法讓對象可以表現得像內建類型一樣。__str__函數__str__函數用於處理列印執行個體本身的時候的輸出內容。如果沒有覆寫該函數,則預設輸出一個對象名稱和記憶體位址。例如:>>> class Student(object):... def __init__(self,name):...
Time of Update: 2017-02-18
在使用Django和Angular的過程中,遇到過一個Angular向Django POST資料的問題。// Angular$http({ url: "myviews", method: "POST", data: {'text': 'hello world', 'date': '2017-01-04'}})# Djangodef myviews(request):
Time of Update: 2017-02-18
python中字串可以(且僅可以)使用成對的單引號、雙引號、三個雙引號(文檔字串)包圍:'this is a book' "this is a book""""this is a book"""可在單引號包圍的字串中包含雙引號,三引號等,但不能包含單引號自身(需轉義)'this is a" book''this is a"" book'
Time of Update: 2017-02-19
Python version 2.7 required, which was not found in the registry 問題解決,pythonrequired問題:在安裝MySQL-python 1.2.5時出現提示Python version 2.7 required, which was not found in the registry問題解決如下:執行以下代碼,再次安裝便可以了!import sys from _winreg import * #
Time of Update: 2017-02-15
Python 列表(List) 的三種遍曆(序號和值)方法,pythonlist三種遍曆列表裡面序號和值的方法:最近學習python這門語言,感覺到其對自己的工作效率有很大的提升,特在情人節這一天寫下了這篇部落格,下面廢話不多說,直接貼代碼 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 if __name__ == '__main__': 4 list = ['html', 'js', 'css', 'python'] 5 6
Time of Update: 2017-02-15
python基礎3--字串,python3--字串字串 1.大小寫轉換 1 >>> name 2 'bigberg' 3 >>> name.capitalize() # 首字母大寫 4 'Bigberg' 5 >>> name 6 'BiGbeRg' 7 >>> name.casefold() # 大寫字元全部改為小寫 8 'bigberg' 9 10 >>> name.upper()
Time of Update: 2017-02-15
Python抓取第一網貸中國網貸理財每日收益率指數,python抓取連結:http://www.p2p001.com/licai/index/id/147.html 所需擷取資料連結類似於:http://www.p2p001.com/licai/shownews/id/454.html: 庫:requests (For human)re (正則)pandas (用來處理資料)BeautifulSoup
Time of Update: 2017-02-15
Python實現定時任務,Python實現任務Python下實現定時任務的方式有很多種方式。下面介紹幾種迴圈sleep:這是一種最簡單的方式,在迴圈裡放入要執行的任務,然後sleep一段時間再執行。缺點是,不容易控制,而且sleep是個阻塞函數。def timer(n): ''''' 每n秒執行一次 ''' while True: print time.strftime('%Y-%m-%d %X',time.localtime()) yourTask() #
Time of Update: 2017-02-15
python3製作捧腹網段子頁爬蟲,python3捧腹0x01春節閑著沒事(是有多閑),就寫了個簡單的程式,來爬點笑話看,順帶記錄下寫程式的過程。第一次接觸爬蟲是看了這麼一個文章,一個逗逼,爬取煎蛋網上妹子的照片,簡直不要太方便。於是乎就自己照貓畫虎,抓了點圖片。科技啟迪未來,身為一個程式員,怎麼能幹這種事呢,還是爬點笑話比較有益於身心健康。0x02在我們擼起袖子開始搞之前,先來普及點理論知識。簡單地說,我們要把網頁上特定位置的內容,扒拉下來,具體怎麼扒拉,我們得先分析這個網頁,看那塊內容是我們
Time of Update: 2017-02-15
python 資料清洗之資料合併、轉換、過濾、排序,python排序前面我們用pandas做了一些基本的操作,接下來進一步瞭解資料的操作,資料清洗一直是資料分析中極為重要的一個環節。資料合併在pandas中可以通過merge對資料進行合併作業。import numpy as npimport pandas as pddata1 = pd.DataFrame({'level':['a','b','c','d'],