خرید بک لینک

Vote count: 0

I'm trying to call a variables I created in one function inside another module in Python, however, Python can't find them. Heres some example code:

       class1:
       def method1
           var1 = []
           var2 = []
       #Do something with var1 and var2
           print var1
           print var2
           retu var1,var2
       sample = class1()
       sample.method1

here is class 2

     from class1 import *

     class number2:
     sample.method1()

This does as intended and prints var1 and var2 but I can't call var1 or var2 inside class number 2

asked 58 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 10 ارديبهشت 1395 ساعت: 4:35

صفحه بندی