Python網絡資源 + Python Manual

如何學習Python + 如何有效利用Python有關的網絡資源 + 如何利用Python自帶手冊(Python Manual)

【整理】總結Python2(Python 2.x版本)和Python3(Python 3.x版本)之間的區別html

而後根據狀況,選擇本身須要的python版本,而後才涉及到,如何學習的問題。java

 

【學習Python的基本流程】python

1.先學習Python的基礎知識編程

推薦資料:windows

Dive Into Python網絡

中文主頁是:app

http://woodpecker.org.cn/diveintopython/框架

 

能夠在線看:ide

深刻 Python :Dive Into Python 中文版函數

也能夠下載各類格式:

留本地看。 

 

1. Python的第三方庫

python的第三方庫,數量巨大,功能巨多,可是正是因爲太多,不可能一一總結。

可是python官網,人家已經整理出來了,都放到這裏了:

http://pypi.python.org/pypi?%3Aaction=index

該頁面因爲庫太多,看着很不方便。

這裏有分類查看:

http://pypi.python.org/pypi?%3Aaction=browse 

若是須要某些方面的功能,能夠去上述兩個地址中,找找有沒有現成的庫,若是有的話,直接拿過來用,比你從頭開發,要高效的多。

 

2. 各類Python的總結方面的資料

其中包括我寫的Python語言總結,其中主要分兩塊:

(1)python學習心得和體會

總結了本身折騰python過程當中的一些理解,和一些細節方面的注意事項。

(2)crifan的Python庫:crifanLib.py

本身把一些經常使用的Python的函數,整理出來,供本身和別人使用。

尤爲是不少網絡方面的函數,等你用到了,就會知道會省你很多精力的。

 

【如何利用Python自帶手冊 Python Manual】

其中,關於查參考資料,特別要提示的一點是,對於不少不熟悉的python函數,最佳的學習方法,我的認爲是先去Python自帶手冊中去查找。

而Python自帶手冊,是你安裝好Python以後,(個人是windows環境,經過exe安裝的python 2.7版的),能夠經過開始->Python 27-> Python Mannuals:

python manual

 

好比涉及到網絡編程,須要用到urllib2這個模塊,想要搞懂urllib2。

那麼第一步,就能夠先去經過manual找到urllib2:

find urllib2

而後再去看看其語法:

urllib2. urlopen (url[, data][, timeout] )
Open the URL url, which can be either a string or a  Request object.

Warning

HTTPS requests do not do any verification of the server’s certificate.

data may be a string specifying additional data to send to the server, or None if no such data is needed. Currently HTTP requests are the only ones that use data; the HTTP request will be a POST instead of a GET when the data parameter is provided. data should be a buffer in the standard application/x-www-form-urlencoded format. The urllib.urlencode() function takes a mapping or sequence of 2-tuples and returns a string in this format. urllib2 module sends HTTP/1.1 requests withCONNECTION:CLOSEheader included.

The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). This actually only works for HTTP, HTTPS and FTP connections.

This function returns a file-like object with two additional methods:

  • geturl() — return the URL of the resource retrieved, commonly used to determine if a redirect was followed
  • info() — return the meta-information of the page, such as headers, in the form of an mimetools.Message instance (see Quick Reference to HTTP Headers)

Raises URLError on errors.

Note that None may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens).

In addition, default installed ProxyHandler makes sure the requests are handled through the proxy when they are set.

Changed in version 2.6: timeout was added.

如此,對於其有個基本的瞭解後,再去網上詳細看看別人的示例代碼。

這樣,有助於你快速,準確的,學習此庫函數。

至少,我對於不少不少的python內置庫函數,都是這樣慢慢逐漸學習和了解的。

 

 

相關文章
相關標籤/搜索