Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Goods:
- def __init__(self,goods=[]):
- self.goods=goods
- def __str__(self):
- return str(self.goods)
- def append(self,data):
- self.goods.append(data)
- def wrote(self):
- for i in self.goods:
- f.write(i)
- def max_price(self):
- cnt=0
- l=[]
- for i in self.goods:
- c=i.split(" ")
- if cnt < int(c[3]):
- cnt =int(c[3])
- l.clear()
- l.append(i)
- print(l)
- def all_companies(self):
- l=[]
- for i in self.goods:
- c=i.split(" ")
- l.append(c[2])
- print(l)
- def __iter__(self):
- return self
- meow=open(r"C:\Users\nikit\Downloads\lrh.txt","r")
- texts=meow.readlines()
- print(texts[0])
- a=Goods(texts)
- print(a)
- a.append("1 2 3 4")
- print(a)
- meow.close()
- f=open(r"C:\Users\nikit\Downloads\asdf.txt","w")
- a.wrote()
- f.close()
- a.max_price()
- a.all_companies()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement