1
0

file i/o: use 'with' keyword

This commit is contained in:
SomberNight
2017-11-12 14:33:46 +01:00
parent 8fcf1656d3
commit c65d01ea96
8 changed files with 22 additions and 20 deletions

View File

@@ -41,7 +41,8 @@ from . import segwit_addr
def read_json_dict(filename):
path = os.path.join(os.path.dirname(__file__), filename)
try:
r = json.loads(open(path, 'r').read())
with open(path, 'r') as f:
r = json.loads(f.read())
except:
r = {}
return r