diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2018-10-07 00:07:50 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2018-10-07 01:55:34 +0200 |
commit | f871a904201eaf645faa159ead720975818f0a69 (patch) | |
tree | 628b36b0f491efccc01bd5173d7cdeb798bf9270 | |
parent | 9c51bbe5016495c714789f5df01806a6d366e11a (diff) |
util: add another path to search for fortunes
-rwxr-xr-x | kpov_judge/kpov_util.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kpov_judge/kpov_util.py b/kpov_judge/kpov_util.py index 491e7ce..74b1737 100755 --- a/kpov_judge/kpov_util.py +++ b/kpov_judge/kpov_util.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import itertools import random import string import socket @@ -19,7 +20,9 @@ def alnum_gen(r, l=1): def fortune(r, max_len): all_fortunes = [] - for fortune_file in glob.glob('/usr/share/games/fortunes/*.u8'): + for fortune_file in itertools.chain( + glob.iglob('/usr/share/fortune/*.u8'), + glob.iglob('/usr/share/games/fortunes/*.u8')): f = open(fortune_file) l = f.read().split('\n%\n')[:-1] for i in l: |