python class weave numberrows together -
i wrote following class weave multiple rows of number together, how print result?
class numberrow(object): def __init__(self, row2): self.row = row2 self.amount = len(row2) def weave(self,other): lijst = [] in range(self.amount): lijst.append(self.row[i]) lijst.append(other.row[i]) self.row = lijst
from ipy_lib import file_input number_row import numberrow '''program''' bestand = file_input().splitlines() lijst1 = bestand[0].split() lijst2 = bestand[1].split() lijst3 = bestand[2].split() row1 = numberrow(lijst1) row2 = numberrow(lijst2) row3 = numberrow(lijst3) row1.weave(row2) number_list = row1.weave(row3) print number_list
i "nonetype" error. how can make sure class object becomes printable?
method weave
not returning anything, need modify code this:
def weave(self,other): lijst = [] in range(self.amount): lijst.append(self.row[i]) lijst.append(other.row[i]) self.row = lijst return self.row
Comments
Post a Comment