summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-07 00:07:50 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-07 01:55:34 +0200
commitf871a904201eaf645faa159ead720975818f0a69 (patch)
tree628b36b0f491efccc01bd5173d7cdeb798bf9270
parent9c51bbe5016495c714789f5df01806a6d366e11a (diff)
util: add another path to search for fortunes
-rwxr-xr-xkpov_judge/kpov_util.py5
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: