context manager for file handling changed too in from_file function

This commit is contained in:
IsxImattI 2024-11-11 00:23:37 +01:00
parent 466d9925b2
commit f176dd0027

View File

@ -171,7 +171,8 @@ def solved(values):
def from_file(filename, sep="\n"):
"Parse a file into a list of strings, separated by sep."
return open(filename).read().strip().split(sep)
with open(filename) as file:
return file.read().strip().split(sep)
def random_puzzle(assignments=17):