Python 筆記:PIL/Pillow 圖像處理庫快速入門
PIL / Pillow 簡介 PIL (Python Imaging Library) 是 Python 平台最經典的圖像處理庫,現由 Pillow 友好分支
Python with as 語句詳解:資源管理最佳實踐(繁體版)
with ... as 上下文管理器是 Python 處理資源(文件、鎖、網絡連接等)的標準方式,自動保證異常時也能正確釋放資源。本文對比傳統寫法,解析原理,並
Python: Query Class or Object Methods with dir() Function
Developers often need to quickly inspect methods/attributes of an object or clas
Python Anonymous & Recursive Functions: lambda and Recursion Deep Dive
Python offers lambda anonymous functions and recursive functions for inline simp
Python Functions Advanced: Multiple Returns, Default Arguments, Parameter Rules
Python functions are more flexible than C++: multiple return values (tuple), def
Python Set Operations Complete Guide: 17 Methods with Examples
Python sets are unordered collections of unique elements. This guide systematica
Python Function Writing Examples: From No-Args to Return Values
Functions are the core modularization tool in Python. This article presents thre
C/C++ and Python: Distinguishing NULL and None Clearly
In cross-language development, NULL (C/C++) and None (Python) are often confused
C/C++ et Python : Différences entre NULL et None
En développement multi-langages, NULL (C/C++) et None (Python) sont souvent conf
C/C++ 與 Python 中 NULL 與 None 的區別詳解(繁體版)
跨語言開發時,NULL(C/C++)與 None(Python)常被混淆。本文從定義、本質、用法、比較行為等維度深度解析兩者差異,助你避開常見坑點。 NULL:
Python 隱藏密碼輸入:getpass 模塊實戰與 offlineimap 集成
終端輸入密碼時明文顯示極不安全。Python 標準庫 getpass 模塊(及第三方 getpass4)可實現無回顯輸入。本文演示基本用法、GPG 解密密碼文件
Python 多線程配合 PyTorch DataLoader 加速數據讀取
模型訓練中,GPU 算力常被 CPU 數據讀取拖累。PyTorch DataLoader(num_workers>0) 在 Windows 下易出問題。本
IPython 歷史記錄導出為 .py 文件:三種實用方法
IPython 交互式環境極其方便,但代碼無法直接保存。本文介紹三種將會話歷史導出為可執行 .py 文件的方法:%hist、%logstart/%logstop
Python with as 語句詳解:資源管理最佳實踐
with ... as 上下文管理器是 Python 處理資源(文件、鎖、網絡連接等)的標準方式,自動保證異常時也能正確釋放資源。本文對比傳統寫法,解析原理,並
Python 函數進階:多返回值、默認參數、參數順序規則
Python 函數比 C++ 更靈活:支援多返回值(元組)、默認參數、關鍵字參數等。本文通過計算正方形面積的例子,講解 return 多值、默認參數定義規則、參
Python 匿名函數與遞歸函數詳解:lambda 與遞歸實戰
Python 提供 lambda 匿名函數與遞歸函數兩種特殊函數形式,分別適用於簡單邏輯內聯與自我調用問題分解。本文通過概念、語法、示例、注意事項、局限性全方位
Python 查詢類或對象所有方法:dir() 函數完整指南
開發中常需快速查看某個對象或類擁有哪些方法、屬性。Python 內置 dir() 函數正是為此而生。本文通過字典對象與字典類的實例,演示 dir() 的用法、輸
C/C++ 與 Python 中 NULL 與 None 的區別詳解
跨語言開發時,NULL(C/C++)與 None(Python)常被混淆。本文從定義、本質、用法、比較行為等維度深度解析兩者差異,助你避開常見坑點。 NULL: