Python Phrasebook (Paperback)
暫譯: Python 短語手冊 (平裝本)

Brad Dayley

  • 出版商: SAMS
  • 出版日期: 2006-11-16
  • 售價: $1,300
  • 貴賓價: 9.5$1,235
  • 語言: 英文
  • 頁數: 288
  • 裝訂: Paperback
  • ISBN: 0672329107
  • ISBN-13: 9780672329104
  • 相關分類: Python
  • 已絕版

買這商品的人也買了...

商品描述

Description

Python Phrasebook

 

Brad Dayley

 

Essential Code and Commands

 

Python Phrasebook gives you the code phrases you need to quickly and effectively complete your programming projects in Python.

 

Concise and Accessible

Easy to carry and easy to use—lets you ditch all those bulky books for one portable guide

 

Flexible and Functional

Packed with more than 100 customizable code snippets—so you can readily code functional Python in just about any situation

 

Brad Dayley is a software engineer at Novell, Inc. He has been a system administrator and software developer on the Unix, Windows, Linux, and NetWare platforms for the past 14 years. Brad co-developed an advanced debugging course used to train engineers and customers and is the co-author of several Novell Press books.

 

 

Table of Contents

Chapter 1 Understanding Python 3

Why Use Python?

Invoking the Interpreter

Built-In Types

Understanding Python Syntax

Python Objects, Modules, Classes, and Functions

Error Handling

Using System Tools

Chapter 2 Manipulating Strings

Comparing Strings

Joining Strings

Splitting Strings

Searching Strings for Substrings

Search and Replace in Strings

Searching Strings for Specific Endings/Beginnings

Trimming Strings

Aligning/Formatting Strings

Executing Code Inside Strings

Interpolating Variables Inside Strings

Converting Unicode to Local Strings

Chapter 3 Managing Data Types

Defining a List

Accessing a List

Slicing a List

Adding and Removing Items in a List

Sorting a List

Using Tuples

Constructing a Dictionary

Adding a Value to a Dictionary

Retrieving a Value from a Dictionary

Slicing a Dictionary

Swapping Keys for Values in a Dictionary

Chapter 4 Managing Files

Opening and Closing Files

Reading an Entire File

Reading a Single Line from a File

Accessing Each Word in a File

Writing a File

Determining the Number of Lines in a File

Walking the Directory Tree

Renaming Files

Recursively Deleting Files and Subdirectories

Searching for Files Based on Extension

Creating a TAR File

Extracting a File from a TAR File

Adding Files to a ZIP File

Retrieving Files from a ZIP File

Chapter 5 Managing Threads

Starting a New Thread

Creating and Exiting Threads

Synchronizing Threads

Implementing a Multithreaded Priority Queue

Initiating a Timer-Interrupted Thread

Chapter 6 Managing Databases

Adding Entries to a DBM File

Retrieving Entries from a DBM File

Updating Entries in a DBM File

Pickling Objects to a File

Unpickling Objects from a File

Storing Objects in a Shelve File

Retrieving Objects from a Shelve File

Changing Objects in a Shelve File

Connecting to a MySQL Database Server

Creating a MySQL Database

Adding Entries to a MySQL Database

Retrieving Entries from a MySQL Database

Chapter 7 Implementing Internet Communication

Opening a Server-Side Socket for Receiving Data

Opening a Client-Side Socket for Sending Data

Receiving Streaming Data Using the ServerSocket Module

Sending Streaming Data

Sending Email Using SMTP

Retrieving Email from a POP3 Server

Using Python to Fetch Files from an FTP Server

Chapter 8 Processing HTML

Parsing URLs

Opening HTML Documents

Retrieving Links from HTML Documents

Retrieving Images from HTML Documents

Retrieving Text from HTML Documents

Retrieving Cookies in HTML Documents

Adding Quotes to Attribute Values in HTML Documents

Chapter 9 Processing XML

Loading an XML Document

Checking for Well-Formed XML Documents

Accessing Child Nodes

Accessing Element Attributes

Adding a Node to a DOM Tree

Removing a Node from a DOM Tree

Searching XML Documents

Extracting Text from XML Documents

Parsing XML Tags

Chapter 10 Programming Web Services

Adding HTML to Web Pages Using CGI Scripts

Processing Parameters Passed to CGI Scripts

Creating Self-Posting CGI Scripts

Allowing Users to Upload Files via CGI Scripts

Creating an HTTP Server to Handle GET Requests

Creating an HTTP Server to Handle POST Requests

Creating an HTTP Server to Process CGI Scripts

Sending an HTTP GET Request from a Python Script

Sending an HTTP POST Request from a Python Script

Creating an XML-RPC Server

Creating an XML-RPC Client

Using SOAPpy to Access SOAP Web Services Through a WSDL F

 

商品描述(中文翻譯)

描述

Python 短語手冊

Brad Dayley

基本代碼與命令

《Python 短語手冊》提供了您在 Python 中快速有效完成編程項目所需的代碼短語。

簡潔易懂

便於攜帶且易於使用——讓您不再需要那些笨重的書籍,只需一本便攜指南。

靈活且功能強大

內含超過 100 個可自定義的代碼片段——讓您能夠在幾乎任何情況下輕鬆編寫功能性 Python 代碼。

Brad Dayley 是 Novell, Inc. 的軟體工程師。他在 Unix、Windows、Linux 和 NetWare 平台上擔任系統管理員和軟體開發者已有 14 年。Brad 共同開發了一門用於培訓工程師和客戶的高級除錯課程,並且是幾本 Novell Press 書籍的共同作者。

目錄

第 1 章 理解 Python 3
為什麼使用 Python?
調用解釋器
內建類型
理解 Python 語法
Python 對象、模組、類別和函數
錯誤處理
使用系統工具

第 2 章 操作字串
比較字串
連接字串
分割字串
在字串中搜尋子字串
在字串中搜尋和替換
搜尋字串的特定結尾/開頭
修剪字串
對齊/格式化字串
在字串中執行代碼
在字串中插入變數
將 Unicode 轉換為本地字串

第 3 章 管理數據類型
定義列表
訪問列表
切片列表
在列表中添加和移除項目
排序列表
使用元組
構建字典
向字典中添加值
從字典中檢索值
切片字典
在字典中交換鍵和值

第 4 章 管理檔案
打開和關閉檔案
讀取整個檔案
從檔案中讀取單行
訪問檔案中的每個單詞
寫入檔案
確定檔案中的行數
遍歷目錄樹
重命名檔案
遞歸刪除檔案和子目錄
根據擴展名搜尋檔案
創建 TAR 檔案
從 TAR 檔案中提取檔案
向 ZIP 檔案中添加檔案
從 ZIP 檔案中檢索檔案

第 5 章 管理執行緒
啟動新執行緒
創建和退出執行緒
同步執行緒
實現多執行緒優先佇列
啟動計時器中斷的執行緒

第 6 章 管理資料庫
向 DBM 檔案中添加條目
從 DBM 檔案中檢索條目
更新 DBM 檔案中的條目
將對象序列化到檔案
從檔案中反序列化對象
將對象存儲在 Shelve 檔案中
從 Shelve 檔案中檢索對象
更改 Shelve 檔案中的對象
連接到 MySQL 資料庫伺服器
創建 MySQL 資料庫
向 MySQL 資料庫中添加條目
從 MySQL 資料庫中檢索條目

第 7 章 實現網際網路通信
打開伺服器端套接字以接收數據
打開客戶端套接字以發送數據
使用 ServerSocket 模組接收串流數據
發送串流數據
使用 SMTP 發送電子郵件
從 POP3 伺服器檢索電子郵件
使用 Python 從 FTP 伺服器獲取檔案

第 8 章 處理 HTML
解析 URL
打開 HTML 文件
從 HTML 文件中檢索鏈接
從 HTML 文件中檢索圖像
從 HTML 文件中檢索文本
從 HTML 文件中檢索 Cookie
在 HTML 文件中的屬性值中添加引號

第 9 章 處理 XML
加載 XML 文件
檢查 XML 文件的格式是否正確
訪問子節點
訪問元素屬性
向 DOM 樹中添加節點
從 DOM 樹中移除節點
搜尋 XML 文件
從 XML 文件中提取文本