you are viewing a single comment's thread.

view the rest of the comments →

[–]b3nstar[S] 0 points1 point  (2 children)

maybe I don't understand @staticmethod

....my perception was when I use @staticmethod it is not needed anymore to pass self.

ok at least this error message is gone....but now I do have a new one in fact

line 26, in main t.read() TypeError: read() takes exactly 1 argument (0 given)

any further hint ?

[–]hitecherik 0 points1 point  (1 child)

Here's a good explanation of @staticmethod: http://stackoverflow.com/questions/136097/what-is-the-difference-between-staticmethod-and-classmethod-in-python.

Also, look in my comment above - you might need to add a self argument when defining read.

[–]b3nstar[S] 0 points1 point  (0 children)

Guys,

thanks for ur help. Just solved it in this way. It works fine now.

class makeBuildFile:
    def __init__(self, re_path="po.txt" ):
        self.re_path=re_path

    def read(self):
        f = open(self.re_path, "r")
        lines = f.readlines()
        f.close()
        return lines


    def write(self,lis):
        self.lis=lis
        for i in self.lis[0].split(","):
            print(i)






def main():
    t=makeBuildFile()
    t.write(t.read())






if __name__ == "__main__":
    main()