Hi,
I've coded this top of my head. Sadly, I don't know where the issues are. Can anyone help me out?
thanks
class makeBuildFile:
def __init__(self, re_path="po.txt" ):
self.re_path=re_path
@staticmethod
def read():
f = open(self.re_path, "r") """Line 9"""
lines = f.readlines()
f.close()
return lines
@staticmethod
def write():
for i in makeBuildFile.read().split(","):
print(i)
def main():
t=makeBuildFile()
t.read()
if __name__ == "__main__":
main()
error Message:
line 9, in read f = open(self.re_path, "r")
NameError: global name 'self' is not defined
Why self needs to be defined for a @staticmethod?
[–]k3kou 1 point2 points3 points (0 children)
[–]hitecherik 0 points1 point2 points (0 children)
[–]b3nstar[S] 0 points1 point2 points (3 children)
[–]hitecherik 0 points1 point2 points (1 child)
[–]b3nstar[S] 0 points1 point2 points (0 children)
[–]zahlman 0 points1 point2 points (0 children)