Time of Update: 2015-06-18
標籤:python 日誌 入庫 #usr/bin/evn python#-*- coding: utf-8 -*-import os, sysimport reimport MySQLdbdb =
Time of Update: 2015-06-18
標籤:eularproject1000-digit Fibonacci numberProblem 25The Fibonacci sequence is defined by the recurrence relation:Fn = Fn?1 + Fn?2, where F1 = 1 and F2 = 1.Hence the first 12 terms will be:F1 = 1F2 = 1F3 =
Time of Update: 2015-06-17
標籤:最近做一個項目是解析XML檔案,提取其中的chatid和lt、timestamp等資訊,存到excel裡。1.解析xml,提取資料使用python內建的xml.dom中的minidom(也可以用lxml)xml檔案如下:minidom.parse()#解析檔案,返回DOM對象_get_documentElement()DOM是樹形結構,獲得了樹形結構的根節點getElementsByTagName()根據name尋找根目錄下的子節點getAttribute()擷取DOM節點的屬性的值提取的
Time of Update: 2015-06-18
標籤:python pil 第 0022 題: iPhone 6、iPhone 6 Plus 早已上市開賣。請查看你寫得 第 0005 題的代碼是否可以複用。思路:跟第五題一樣,遍曆給出目錄下的圖片,把大於iPhone5解析度的圖片都進行縮放。使用Python的PIL庫對圖片進行處理,IPhone5螢幕解析度為640 ×
Time of Update: 2015-06-16
標籤:python 檔案 指令碼 備份 檔案備份指令碼,實現了按照日期歸類,時間建備份檔案的功能,還能加入使用者的備忘資訊。#!/usr/bin/python#Filename:backup_ver3.pyimport osimport time#1.source file which to be backed up.source =
Time of Update: 2015-06-16
標籤:python 老男孩 課程表 因為看見老男孩的學員做過這一期,也很有興趣,並且剛在學python,所以用python實現了下。由於剛學習python,肯定還有很多地方可以最佳化。#!/bin/bash# oldboy linux training# 2015-06-01# Happy Children‘s Day#&nb
Time of Update: 2015-06-13
標籤:opencv python 配置 一般情況下,Python不包括OpenCV模組,需要自己安裝或者配置,安裝比較簡單我就不說了,說一下自己下載模組,動手配置(因為lz用的是WinPython,綠色版非安裝,雖然整合了很多模組,但是木有OpenCV,也不能直接安裝,只能自己配置)那麼首先要先下載模組包,可以去我的資源裡下載Python2.x的32位OpenCV或64位OpenCV,若是Pyt
Time of Update: 2015-06-12
標籤:Python xlrd、xlwt、xlutils讀取、修改Excel檔案 一、xlrd讀取excel 這裡介紹一個不錯的包xlrs,可以工作在任何平台。這也就意味著你可以在Linux下讀取Excel檔案。首先,開啟workbook; import xlrdwb = xlrd.open_workbook(‘myworkbook.xls‘)檢查表單名字:
Time of Update: 2015-06-10
標籤:python 筆記 函數 函數匯入的三種方式from math import sqrt #import the sqrt function only e.g. sqrt(25)from
Time of Update: 2015-06-10
標籤:python excel import 微軟 下載安裝 xlrd是專門用來在python中讀取微軟execel的模組,可以自己直接下載安裝,也可以通過包管理器安裝。組件的官網地址:http://www.python-excel.org/基本操作:#-*-encoding:utf-8-*-
Time of Update: 2015-06-09
標籤:python template string 模板 1.什麼是templatetemplate是python中的string庫的一部分使用template可以不編輯應用就可以改變其中的資料範本還可以被他的子類修改2.
Time of Update: 2015-06-09
標籤:python的set和其他語言類似, 是一個無序不重複元素集, 準系統包括關係測試和消除重複元素. 集合對象還支援union(聯合), intersection(交), difference(差)和sysmmetric difference(對稱差集)等數學運算. 下面來點簡單的小例子說明把。 >>> x = set(‘spam‘) >>> y = set([‘h‘,‘a‘,
Time of Update: 2015-06-06
標籤:Python的hashlib模組可以實現很多密碼編譯演算法1.SHA-1加密import hashlibdef Str2SHA1(s): m=hashlib.sha1() m.update(s) return m.hexdigest()if __name__=="__main__": s="www.baidu.com" print Str2SHA1(s)2.OpenSSL提供的密碼編譯演算法 1 import hashlib 2 3 def
Time of Update: 2015-06-05
標籤:V=models.CharField(max_length=None[, **options]) #varcharV=models.EmailField([max_length=75, **options]) #varcharV=models.URLField([verify_exists=True, max_length=200, **options]) #varcharV=models.FileField(upload_to=None[, max_length=100
Time of Update: 2015-06-05
標籤:python基礎python可執行程式路徑:/usr/bin/pythonpython檔案類型: 1、.py 由程式解釋,不需要編譯 2、.pyc
Time of Update: 2015-06-05
標籤:python socket 連接埠 掃描 前幾天看了個講使用Python掃描連接埠的教程,看了之後自己也寫了個掃描連接埠的指令碼。記錄下來,方便自己以後回顧。 運行效果如下:650)
Time of Update: 2015-06-03
標籤:機器學習 python import mahotas as mh import numpy as np from matplotlib import pyplot as plt
Time of Update: 2015-06-03
標籤:python 正則基礎~使用Regex - re模組提供了一個Regex引擎的介面,可以讓你將REstring編譯成對象並用他們來進行匹配。 #如果經常使用,建議編譯 compile範例:>>> r1=r‘^\d{3,4}-?\d{8}‘>>> re.findall(r1,‘010-1234567
Time of Update: 2015-06-03
標籤:leetcode python Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
Time of Update: 2015-06-03
標籤: 2013-07-30 22:54 by 江湖麼名, 2359 閱讀, 0 評論, 收藏, 編輯Beautiful Soup 是用 Python 寫的一個 HTML/XML 的解析器,它可以很好的處理不規範標記並產生剖析樹。通常用來分析爬蟲抓取的web文檔。對於 不規則的 Html文檔,也有很多的補全功能,節省了開發人員的時間和精力。Beautiful Soup