more pythonic way

This commit is contained in:
Vitesh Shah 2018-05-25 11:16:56 +02:00
parent bdfd3974d5
commit 54bccbe084
1 changed files with 2 additions and 3 deletions

View File

@ -172,9 +172,8 @@ class Material():
self.data[part][name_section][items[0]] = items[1:]
def read(self,file=None):
f=open(file,'r')
c=f.readlines()
f.close()
with open(file,'r') as f:
c=f.readlines()
for p in self.parts:
self.parse_data(part=p, content=c)