Python How-To: 63 Techniques to Improve Your Python Code (Python 實用技巧:63 種提升 Python 代碼的技術)

Cui, Yong

  • 出版商: Manning
  • 出版日期: 2023-08-04
  • 定價: $1,800
  • 售價: 9.0$1,620
  • 語言: 英文
  • 頁數: 504
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 161729974X
  • ISBN-13: 9781617299742
  • 相關分類: Python程式語言
  • 立即出貨 (庫存 < 4)

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

相關主題

商品描述

Have you ever asked yourself, "How do I do that in Python?" If so, you'll love this practical collection of the most important Python techniques.

Python How-To includes over 60 detailed answers to questions like:

 

  • How do I join and split strings?
  • How do I access dictionary keys, values, and items?
  • How do I set and use the return value in function calls?
  • How do I process JSON data?
  • How do I create lazy attributes to improve performance?
  • How do I change variables in a different namespace?


...and much more

Python How-To walks you through the most important coding techniques in Python. Whether you're doing data science, building web applications, or writing admin scripts, you'll find answers to your "how-to" questions in this book. Inside you'll find important insights into both Python basics and deep-dive topics to help you skill-up at any stage of your Python career. Author Yong Cui's clear and practical writing is instantly accessible and makes it easy to take advantage of Python's versatile tools and libraries. Perfect to be read both from cover to cover, and whenever you need help troubleshooting your code.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Technology

Python How-To uses a simple but powerful method to lock in 63 core Python skills. You'll start with a question, like "How do I find items in a sequence?" Next, you'll see an example showing the basic solution in crystal-clear code. You'll then explore interesting variations, such as finding substrings or identifying custom classes. Finally, you'll practice with a challenge exercise before moving on to the next How-To.

About the Book

This practical guide covers all the language features you'll need to get up and running with Python. As you go, you'll explore best practices for writing great Python code. Practical suggestions and engaging graphics make each important technique come to life. Author Yong Cui's careful cross-referencing reveals how you can reuse features and concepts in different contexts.

What's Inside

How to:

 

  • Join and split strings
  • Access dictionary keys, values, and items
  • Set and use the return value in function calls
  • Process JSON data
  • Create lazy attributes to improve performance
  • Change variables in a different namespace


...and much more.

About the Reader

For beginning to intermediate Python programmers.

About the Author

Dr. Yong Cui has been working with Python in bioscience for data analysis, machine learning, and tool development for over 15 years.

Table of Contents

1 Developing a pragmatic learning strategy
PART 1 - USING BUILT-IN DATA MODELS
2 Processing and formatting strings
3 Using built-in data containers
4 Dealing with sequence data
5 Iterables and iterations
PART 2 - DEFINING FUNCTIONS
6 Defining user-friendly functions
7 Using functions beyond the basics
PART 3 - DEFINING CLASSES
8 Defining user-friendly classes
9 Using classes beyond the basics
PART 4 - MANIPULATING OBJECTS AND FILES
10 Fundamentals of objects
11 Dealing with files
PART 5 - SAFEGUARDING THE CODEBASE
12 Logging and exception handling
13 Debugging and testing
PART 6 - BUILDING A WEB APP
14 Completing a real project

商品描述(中文翻譯)

你有沒有曾經問過自己:「我該如何在Python中做這個?」如果是的話,你一定會喜歡這本實用的Python技巧集合。

《Python How-To》包含了超過60個詳細的問題解答,例如:
- 如何連接和分割字符串?
- 如何訪問字典的鍵、值和項目?
- 如何設置和使用函數調用的返回值?
- 如何處理JSON數據?
- 如何創建延遲屬性以提高性能?
- 如何在不同的命名空間中更改變量?

......還有更多。

《Python How-To》將引導你學習Python中最重要的編程技巧。無論你是從事數據科學、構建網絡應用還是編寫管理腳本,你都能在這本書中找到對你的「如何」問題的答案。書中提供了有關Python基礎知識和深入主題的重要見解,幫助你在Python職業生涯的任何階段提升技能。作者崔勇清晰而實用的寫作風格讓人容易理解並能充分利用Python的多功能工具和庫。這本書可以從頭到尾閱讀,也可以在需要疑難解答時隨時翻閱。

購買印刷版書籍還包括Manning Publications提供的PDF、Kindle和ePub格式的免費電子書。

關於技術方面,《Python How-To》使用了一種簡單而強大的方法來掌握63個核心Python技能。你將從一個問題開始,比如「如何在序列中找到項目?」接下來,你將看到一個示例,展示了基本解決方案的清晰代碼。然後,你將探索有趣的變化,比如查找子字符串或識別自定義類。最後,在進入下一個「如何」之前,你將通過挑戰練習來練習。

這本實用指南涵蓋了你需要掌握的所有Python語言特性。在學習的過程中,你將探索撰寫優秀Python代碼的最佳實踐。實用的建議和引人入勝的圖形使每個重要的技巧變得生動起來。作者崔勇仔細的交叉引用揭示了如何在不同的情境中重複使用功能和概念。

內容簡介:
- 如何連接和分割字符串
- 訪問字典的鍵、值和項目
- 設置和使用函數調用的返回值
- 處理JSON數據
- 創建延遲屬性以提高性能
- 在不同的命名空間中更改變量
......還有更多。

適合讀者:
初級到中級的Python程序員。

關於作者:
崔勇博士在生物科學領域使用Python進行數據分析、機器學習和工具開發已有15年之久。

目錄:
1. 制定實用的學習策略
第一部分 - 使用內置數據模型
2. 處理和格式化字符串
3. 使用內置數據容器
4. 處理序列數據
5. 可迭代對象和迭代
第二部分 - 定義函數
6. 定義用戶友好的函數
7. 使用進階函數
第三部分 - 定義類
8. 定義用戶友好的類
9. 使用進階類
第四部分 - 操作對象和文件
10. 對象基礎知識
11. 處理文件
第五部分 - 保護代碼庫
12. 日誌記錄和異常處理
13. 調試和測試
第六部分 - 構建Web應用
14. 完成一個真實項目