Use with block to open file

master
Salvo 'LtWorf' Tomaselli 2017-06-24 10:10:52 +07:00
parent 0778be30a1
commit c4da4bdcb6
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 3 additions and 4 deletions

@ -40,10 +40,9 @@ tests_path = 'test/'
def readfile(fname):
'''Reads a file as string and returns its content'''
fd = open(fname, encoding='utf-8')
expr = fd.read()
fd.close()
return expr
with open(fname, encoding='utf-8') as fd:
expr = fd.read()
return expr
def load_relations():