If Python code written by someone else is hard to decipher (Python)
・ ** If Spyder can be used ** On the Editor screen, with the function name selected, press ^ + I (= control + I) to The Object Inspector will show you what the object is. You can use it to see documentation comments about the function.
・ ** If Spyder cannot be used ** In the python console, \ >>> help (function name) And execute. In that case, the documentation comment is also displayed.
from pylab import *
After that
>>> help(imshow)
Help on function imshow in module matplotlib.pyplot:
imshow(X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=None, vmin=None, vmax=None, origin=None,
extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, resample=None, url=None, hold=None, **kwargs) Display an image on the axes.
Parameters
-----------
X : array_like, shape (n, m) or (n, m, 3) or (n, m, 4)
(Omitted) It looks like.
In a Python script How to make the library available import library name And how to from library name import function name from library name import * There is a way to do it.
import library name If Library name.function name Referenced in.
import pylab pylab.imshow(image) When import cv2 cv2.imshow("image title", image) like Even if each library has an image display function called imshow () You can use it properly.
from pylab import imshow If, It's hard to tell which library imshow () came from.
from pylab import * If, Which library imshow () came from From just that part of the script It's hard to know how to know it mechanically.
from library import * Then, there is a possibility that the identifier will be rewritten unintentionally before you know it. It will be higher. I intended to save the grayscale image with the variable name gray It will be replaced by the pylab.gray () function. Summary: If Python code written by others is difficult to decipher ^ + I in Spyder integrated environment Help (function name) except in Spyder integrated environment To use.
Recommended Posts