Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Oct 2012 03:12:31 +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-8@freebsd.org
Subject:   svn commit: r242036 - stable/8/games/fortune/tools
Message-ID:  <201210250312.q9P3CVkH058087@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Thu Oct 25 03:12:31 2012
New Revision: 242036
URL: http://svn.freebsd.org/changeset/base/242036

Log:
  MFC r241834:
  	Make do_uniq work with python3
  
  Approved by:	cperciva (implicit)

Modified:
  stable/8/games/fortune/tools/do_uniq.py
Directory Properties:
  stable/8/games/fortune/   (props changed)

Modified: stable/8/games/fortune/tools/do_uniq.py
==============================================================================
--- stable/8/games/fortune/tools/do_uniq.py	Thu Oct 25 03:12:20 2012	(r242035)
+++ stable/8/games/fortune/tools/do_uniq.py	Thu Oct 25 03:12:31 2012	(r242036)
@@ -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.q9P3CVkH058087>