diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-04-29 17:54:30 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-04-29 17:54:30 +0200 |
commit | 08b8a6d6b483ecf2c5b0b0dcc3c6d706d441936b (patch) | |
tree | bb807e1a46b00351c32db6e5f843dd77f9424f2a | |
parent | d332d2a58a9438a69801dbdc8358b99c4f16f705 (diff) |
Use ‘with’ syntax
-rwxr-xr-x | gen/prop/age | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gen/prop/age b/gen/prop/age index 5733344..7105ae1 100755 --- a/gen/prop/age +++ b/gen/prop/age @@ -71,7 +71,6 @@ uprop_get_age(rune ch) def main() -> None: cwd_init() - sys.stdout = open('lib/unicode/prop/uprop_get_age.c', 'w') xs = parse('data/DerivedAge') blksize = -1 @@ -92,7 +91,9 @@ def main() -> None: blksize = bs Cs = [tuple(x) for x in chunks(xs, blksize)] - genfile(Cs, blksize) + with open('lib/unicode/prop/uprop_get_age.c', 'w') as f: + sys.stdout = f + genfile(Cs, blksize) if __name__ == '__main__': main() |