2023年3月7日 星期二

一些 Python 中好用的功能

 查詢一個 Object 中有哪些可用的 Method:

    dir(object_name)

查詢一個 Method 的使用方式:

    help(object_name.method_name)

    寫在一個檔案 (module)、函式 (function) 和類別 (class) 最開頭的多行註解會自動轉為 module、function、class 的 __doc__ 變數的內容,會被當成 help message 印出。

沒有留言:

張貼留言