原创 python super()函數的理解與運用

首先什麼情況下會用到super()函數 在定義類的時候,需要繼承並調用基類屬性,方法使選擇調用super()函數 繼承分爲單繼承和多繼承 首先單繼承的情況,此時爲滿足需要有兩種選擇 調用未綁定的父類構造方法(也就是直接明確指出要

原创 python3.+安裝scrapy框架

之前學到scrapy庫時,在python2中命令行直接用pip 就可以安裝scrapy $pip intall scrapy 但後來一直被編碼問題煩擾,覺得索性不如轉到python3中,安裝scrapy時,一直遇到麻煩,後來看到一篇文章講

原创 requests庫

pip install requests 安裝requests庫 import requests r = requests.get(url) 返回兩個對象,response 對象和request對象 response包含爬蟲返回的內容

原创 實用小技巧

解決廣告,VIP煩惱,看你想看,僅供娛樂 1、安裝適合自己的tampermonkey插件 我的是360極速瀏覽器, 目前使用的360安全瀏覽器不能安裝 2、安裝破解全網VIP視頻會員-去廣告腳本, 腳本描述中有使用方法,點擊VIP在線

原创 python文件操作

打開模式 ‘r’以只讀方式打開文件(默認) >>> open('f:\\learn\\copied.txt') <open file 'f:\\learn\\copied.txt', mode 'r' at 0x000000000370

原创 Python關鍵字及其用法

Python有哪些關鍵字 -Python常用的關鍵字 and, del, from, not, while, as, elif, global, or, with, assert, else, if, pass, yield, brea

原创 笨辦法學Python

學習python前的準備工作: 首先要安裝python,關於如何安裝,請參考http://www.imooc.com/video/3326,視頻講解。 其次是安裝編輯器,windows系統選擇的是notepad++文本編輯器,用瀏覽

原创 笨辦法學python ex29-35

ex29 # -*- coding: utf-8 -*- people = 20 cats = 30 dogs = 15 if people < cats: print "Too many cats! The world is

原创 笨辦法學python ex11-20

ex11 # -*- coding: utf-8 -*- print "How old are you?" # add ',(comma)' 防止輸出新行,結束此行 age = raw_input() print "How tall ar

原创 python2.7 編碼問題

Python報錯:unicodedecodeerror ascii codec can t decode byte 0xe5 in position 0 ordinal not in range 128 那些年我們用Python讀寫中文遇

原创 笨辦法學python ex21-26

ex21 函數中有return可以返回值,沒有return函數返回的是None # -*- coding: utf-8 -*- def add(a, b): print "ADDING %d + %d" %(a, b)

原创 python 的邏輯關係

NOT | TRUE? not False -> True not True -> False OR | True? True or True -> True True or False-> True Fa

原创 easygui庫

import easygui as g def msgbox(msg='消息參數',title='標題參數,默認空字符串',ok_button='ok,按鈕') 我們在調用時可以通過重寫關鍵字參數,更改g.msgbox(msg='消息參數

原创 scrapy基本使用

Global commands: startproject genspider settings runspider shell fetch view Project-only-commands: crawl check list edi

原创 Scrapy框架小例入門

scrapy1.4.0文檔. 創建一個項目 scrapy startproject tutorial #項目名 #其中包含 tutorial/ scrapy.cfg # 部署配置文件 tutori