From 9517cc0469e97bf337c65ef596bd5880cfc262cd Mon Sep 17 00:00:00 2001 From: eadler Date: Thu, 25 Oct 2012 03:12:20 +0000 Subject: [PATCH] MFC r241834: Make do_uniq work with python3 Approved by: cperciva (implicit) git-svn-id: svn://svn.freebsd.org/base/stable/9@242035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- games/fortune/tools/do_uniq.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/games/fortune/tools/do_uniq.py b/games/fortune/tools/do_uniq.py index bea9644d9..6fde74967 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") -- 2.45.0