aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-10-22 02:29:56 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-10-22 02:29:56 +0000
commit1acb71e6990a740a479f94517d379fe701e3aa62 (patch)
tree00671e208ab2f7b9332d6cba548557c9914ecd43 /games
parent7a1595e33bab554eb78204eacaa6f1d1f6d1072c (diff)
downloadsrc-1acb71e6990a740a479f94517d379fe701e3aa62.tar.gz
src-1acb71e6990a740a479f94517d379fe701e3aa62.zip
Make do_uniq work with python3
Approved by: cperciva MFC after: 3 days
Notes
Notes: svn path=/head/; revision=241834
Diffstat (limited to 'games')
-rw-r--r--games/fortune/tools/do_uniq.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/games/fortune/tools/do_uniq.py b/games/fortune/tools/do_uniq.py
index bea9644d9dca..6fde74967e10 100644
--- a/games/fortune/tools/do_uniq.py
+++ b/games/fortune/tools/do_uniq.py
@@ -34,26 +34,26 @@ def edit(datfile):
for line in file(datfile):
if line == "%\n":
key = hash(fortune)
- if not dups.has_key(key):
+ if key not in dups:
dups[key] = []
dups[key].append(fortune)
fortunes.append(fortune)
fortune = ""
else:
fortune += line
- for key in dups.keys():
+ for key in list(dups.keys()):
if len(dups[key]) == 1:
del dups[key]
o = file(datfile + '~', "w")
for fortune in fortunes:
key = hash(fortune)
if key in dups:
- print '\n' * 50
+ print('\n' * 50)
for f in dups[key]:
if f != fortune:
- print f, '%'
- print fortune, '%'
- if raw_input("Remove last fortune? ") == 'y':
+ print(f, '%')
+ print(fortune, '%')
+ if input("Remove last fortune? ") == 'y':
del dups[key]
continue
o.write(fortune + "%\n")