خرید بک لینک

Vote count: 0

I have created a module: test.py. Inside it looks like:

import matplotlib.pyplot as plt   
N = 5
def test_img(data_loc):
    #F = load images from data_loc

    def plot_img(im):
        # a bunch of other codes
        plt.imshow(im)

    for i in range(N):
        plot_img(F(i))

(1) To use it somewhere as import test or from test import test_img, where do I import matplotlib.pyplot as plt? Is it inside test.py like it is now?

(2) Does it matter plot_img is nested inside test_img in this case, if it is only going to be used inside test_img?

(3) Does it matter where do I declare constant N (This is an example, I have a lot of constants)? What if it is used inside plot_img, where do I declare it?

asked 53 secs ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 19 ارديبهشت 1395 ساعت: 9:47

صفحه بندی