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

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

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

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

Modified: stable/9/games/fortune/tools/do_uniq.py
==============================================================================
--- stable/9/games/fortune/tools/do_uniq.py	Thu Oct 25 03:11:18 2012	(r242034)
+++ stable/9/games/fortune/tools/do_uniq.py	Thu Oct 25 03:12:20 2012	(r242035)
@@ -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.q9P3CKG3058022>