Skip to content

Commit 1a194dc

Browse files
authored
Merge pull request #137 from Lauenburg/leander/136-close-file
Leander/136 Close File
2 parents eb13a5f + 8fe5f81 commit 1a194dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

connectomics/data/dataset/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def _get_file_list(name: Union[str, List[str]],
6868

6969
suffix = name.split('.')[-1]
7070
if suffix == 'txt': # a text file saving the absolute path
71-
filelist = [line.rstrip('\n') for line in open(name)]
71+
with open(name) as file:
72+
filelist = [line.rstrip('\n') for line in file]
7273
return filelist
7374

7475
suffix = name.split('/')[-1]

0 commit comments

Comments
 (0)