python相關小技巧(保持更新),python小技巧

來源:互聯網
上載者:User

python相關小技巧(保持更新),python小技巧

1、查看匯入庫的類屬性、方法

python有一點感覺特別不方便的就是,不像C++指定了類型後,該類型的執行個體打個“.”會智能提示它含有的方法或屬性

之前都是靠查看庫對應的官方文檔解決。這次才發現了一個新方法 help,可以列出方法和屬性了

import dlibhelp(dlib.rectangles)Help on class rectangle in module dlib:class rectangle(pybind11_builtins.pybind11_object) |  This object represents a rectangular area of an image. |   |  Method resolution order: |      rectangle |      pybind11_builtins.pybind11_object |      builtins.object |   |  Methods defined here: |   |  __eq__(...) |      __eq__(self: dlib.rectangle, arg0: dlib.rectangle) -> bool |   |  __getstate__(...) |      __getstate__(self: dlib.rectangle) -> tuple |   |  __init__(...) |      __init__(self: dlib.rectangle, left: int, top: int, right: int, bottom: int) -> None |   |  __ne__(...)

2、跳轉至函數定義的原始碼處

使用pycharm,按住CTRL,點擊函數,會跳轉至函數定義處

 

3、定義定長數組

import numpy as nphighlights_add = highlights_sub = np.zeros(256, dtype=np.float64)

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.