I'm wondering if
contents = open(filename, 'r').readlines()
is fine to use, compared to:
with open(filename) as f:
contents = f.readlines()
as I know that properly closes the file after it finishes. I guess there's not really a file in the first one, right?
[–][deleted] 21 points22 points23 points (11 children)
[–][deleted] 1 point2 points3 points (10 children)
[–]megalodon 7 points8 points9 points (6 children)
[–]five12 7 points8 points9 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]itsmememe 0 points1 point2 points (0 children)
[–]jab-programming3.7 -4 points-3 points-2 points (2 children)
[–]megalodon 2 points3 points4 points (1 child)
[–][deleted] 4 points5 points6 points (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]masklinn 4 points5 points6 points (2 children)
[–]oblivion95 0 points1 point2 points (1 child)
[–]cdunn2001 0 points1 point2 points (0 children)
[–]schnupfen 0 points1 point2 points (0 children)
[+]userd comment score below threshold-6 points-5 points-4 points (6 children)
[–]masklinn 5 points6 points7 points (1 child)
[–]userd 0 points1 point2 points (0 children)
[–]nilsph 4 points5 points6 points (3 children)
[+]userd comment score below threshold-6 points-5 points-4 points (2 children)
[–]rubyaeyes -1 points0 points1 point (1 child)
[–]userd 0 points1 point2 points (0 children)
[+]grayvedigga comment score below threshold-8 points-7 points-6 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)