Date: Thu, 25 Oct 2012 03:12:34 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r242037 - stable/7/games/fortune/tools Message-ID: <201210250312.q9P3CYh7058127@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Thu Oct 25 03:12:34 2012 New Revision: 242037 URL: http://svn.freebsd.org/changeset/base/242037 Log: MFC r241834: Make do_uniq work with python3 Approved by: cperciva (implicit) Modified: stable/7/games/fortune/tools/do_uniq.py Directory Properties: stable/7/games/fortune/ (props changed) Modified: stable/7/games/fortune/tools/do_uniq.py ============================================================================== --- stable/7/games/fortune/tools/do_uniq.py Thu Oct 25 03:12:31 2012 (r242036) +++ stable/7/games/fortune/tools/do_uniq.py Thu Oct 25 03:12:34 2012 (r242037) @@ -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")
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210250312.q9P3CYh7058127>