]> granicus.if.org Git - python/commitdiff
Partial py3k-ification of Doc/library/: convert has_key references into either 'k...
authorCollin Winter <collinw@gmail.com>
Sat, 1 Sep 2007 23:34:30 +0000 (23:34 +0000)
committerCollin Winter <collinw@gmail.com>
Sat, 1 Sep 2007 23:34:30 +0000 (23:34 +0000)
31 files changed:
Doc/library/bsddb.rst
Doc/library/cgi.rst
Doc/library/email.message.rst
Doc/library/imputil.rst
Doc/library/mailbox.rst
Doc/library/rfc822.rst
Doc/library/shelve.rst
Doc/library/shutil.rst
Doc/library/signal.rst
Doc/library/stat.rst
Doc/library/stdtypes.rst
Doc/library/stringio.rst
Doc/library/subprocess.rst
Doc/library/tarfile.rst
Doc/library/telnetlib.rst
Doc/library/test.rst
Doc/library/textwrap.rst
Doc/library/thread.rst
Doc/library/threading.rst
Doc/library/timeit.rst
Doc/library/tix.rst
Doc/library/tkinter.rst
Doc/library/traceback.rst
Doc/library/urllib.rst
Doc/library/urllib2.rst
Doc/library/weakref.rst
Doc/library/wsgiref.rst
Doc/library/xdrlib.rst
Doc/library/xml.etree.elementtree.rst
Doc/library/xml.sax.utils.rst
Doc/library/xmlrpclib.rst

index c5c62762a81018b760caa1af168c1ead957e26a7..aff1d5bb6d9780f2766f285db63ae80037082959 100644 (file)
@@ -105,6 +105,11 @@ Once instantiated, hash, btree and record objects support the same methods as
 dictionaries.  In addition, they support the methods listed below.
 
 
+.. describe:: key in bsddbobject
+
+   Return ``True`` if the DB file contains the argument as a key.
+
+
 .. method:: bsddbobject.close()
 
    Close the underlying file.  The object can no longer be accessed.  Since there
@@ -119,11 +124,6 @@ dictionaries.  In addition, they support the methods listed below.
    returned is different for different file formats.
 
 
-.. method:: bsddbobject.has_key(key)
-
-   Return ``1`` if the DB file contains the argument as a key.
-
-
 .. method:: bsddbobject.set_location(key)
 
    Set the cursor to the item indicated by *key* and return a tuple containing the
@@ -169,7 +169,8 @@ Example::
 
    >>> import bsddb
    >>> db = bsddb.btopen('/tmp/spam.db', 'c')
-   >>> for i in range(10): db['%d'%i] = '%d'% (i*i)
+   >>> for i in range(10):
+   ...     db[str(i)] = '%d' % (i*i)
    ... 
    >>> db['3']
    '9'
@@ -186,7 +187,7 @@ Example::
    >>> db.previous() 
    ('1', '1')
    >>> for k, v in db.iteritems():
-   ...     print k, v
+   ...     print(k, v)
    0 0
    1 1
    2 4
index 98166e86f0806c38b9883ffca904649813abc5c2..d2b88aa5674bc5d0b3cbeb94c3e3093459685ffe 100644 (file)
@@ -91,11 +91,11 @@ various environment variables set according to the CGI standard).  Since it may
 consume standard input, it should be instantiated only once.
 
 The :class:`FieldStorage` instance can be indexed like a Python dictionary, and
-also supports the standard dictionary methods :meth:`has_key` and :meth:`keys`.
-The built-in :func:`len` is also supported.  Form fields containing empty
-strings are ignored and do not appear in the dictionary; to keep such values,
-provide a true value for the optional *keep_blank_values* keyword parameter when
-creating the :class:`FieldStorage` instance.
+also supports the standard dictionary methods :meth:`__contains__` and
+:meth:`keys`.  The built-in :func:`len` is also supported.  Form fields
+containing empty strings are ignored and do not appear in the dictionary; to
+keep such values, provide a true value for the optional *keep_blank_values*
+keyword parameter when creating the :class:`FieldStorage` instance.
 
 For instance, the following code (which assumes that the
 :mailheader:`Content-Type` header and blank line have already been printed)
@@ -103,7 +103,7 @@ checks that the fields ``name`` and ``addr`` are both set to a non-empty
 string::
 
    form = cgi.FieldStorage()
-   if not (form.has_key("name") and form.has_key("addr")):
+   if not ("name" in form and "addr" in form):
        print "<H1>Error</H1>"
        print "Please fill in the name and addr fields."
        return
index 871a5f8be205cbac9597e5046366cd31bd06d880..e494a71c02178b2b43aac387a61dba9c1ef2b407 100644 (file)
@@ -200,7 +200,7 @@ included in the mapping interface.
    No exception is raised if the named field isn't present in the headers.
 
 
-.. method:: Message.has_key(name)
+.. method:: Message.__contains__(name)
 
    Return true if the message contains a header field named *name*, otherwise
    return false.
index 92eeda29a627b5abe7e6c8d3e3152c48233e7d2e..eff1cb90c95048da53aabf766d8fc02d2eab7c33 100644 (file)
@@ -122,10 +122,10 @@ This code is intended to be read, not executed.  However, it does work
        return m
 
    def determine_parent(globals):
-       if not globals or  not globals.has_key("__name__"):
+       if not globals or  not "__name__" in globals:
            return None
        pname = globals['__name__']
-       if globals.has_key("__path__"):
+       if "__path__" in globals:
            parent = sys.modules[pname]
            assert globals is parent.__dict__
            return parent
@@ -156,7 +156,7 @@ This code is intended to be read, not executed.  However, it does work
            parent = None
            q = import_module(head, qname, parent)
            if q: return q, tail
-       raise ImportError, "No module named " + qname
+       raise ImportError("No module named " + qname)
 
    def load_tail(q, tail):
        m = q
@@ -167,7 +167,7 @@ This code is intended to be read, not executed.  However, it does work
            mname = "%s.%s" % (m.__name__, head)
            m = import_module(head, mname, m)
            if not m:
-               raise ImportError, "No module named " + mname
+               raise ImportError("No module named " + mname)
        return m
 
    def ensure_fromlist(m, fromlist, recursive=0):
@@ -185,7 +185,7 @@ This code is intended to be read, not executed.  However, it does work
                subname = "%s.%s" % (m.__name__, sub)
                submod = import_module(sub, subname, m)
                if not submod:
-                   raise ImportError, "No module named " + subname
+                   raise ImportError("No module named " + subname)
 
    def import_module(partname, fqname, parent):
        try:
index ce8dc59058bd1261c1bddddee707c56f19b34818..cfd1ebe4278c2504078e84e4fd4bfe8fe1267be4 100644 (file)
@@ -188,8 +188,7 @@ the corresponding message is subsequently removed.
       subclass.
 
 
-.. method:: Mailbox.has_key(key)
-            Mailbox.__contains__(key)
+.. method:: Mailbox.__contains__(key)
 
    Return ``True`` if *key* corresponds to a message, ``False`` otherwise.
 
index da9f536461a9a39afe6dbd6da6e552cea623acf3..bd8c9a28fb88522a027170c41ca28fdf01fb4e22 100644 (file)
@@ -260,7 +260,7 @@ A :class:`Message` instance has the following methods:
 :class:`Message` instances also support a limited mapping interface. In
 particular: ``m[name]`` is like ``m.getheader(name)`` but raises :exc:`KeyError`
 if there is no matching header; and ``len(m)``, ``m.get(name[, default])``,
-``m.has_key(name)``, ``m.keys()``, ``m.values()`` ``m.items()``, and
+``m.__contains__(name)``, ``m.keys()``, ``m.values()`` ``m.items()``, and
 ``m.setdefault(name[, default])`` act as expected, with the one difference
 that :meth:`setdefault` uses an empty string as the default value.
 :class:`Message` instances also support the mapping writable interface ``m[name]
index 8aa2cf79debda3ef94de73106b3e4e09a5a90f22..262b4a482edee1850b5026564be0cb032ffe09fe 100644 (file)
@@ -131,7 +131,7 @@ object)::
                    # such key)
    del d[key]      # delete data stored at key (raises KeyError
                    # if no such key)
-   flag = d.has_key(key)   # true if the key exists
+   flag = key in d   # true if the key exists
    klist = d.keys() # a list of all existing keys (slow!)
 
    # as d was opened WITHOUT writeback=True, beware:
index 2e3fafe2a9fa2315b04ca5672b76e6e2af9007fe..927ddb0c1a644345b9d6b2d43d79208fd8d5abc2 100644 (file)
@@ -157,5 +157,5 @@ provided by this module. ::
        except OSError as why:
            errors.extend((src, dst, str(why)))
        if errors:
-           raise Error, errors
+           raise Error(errors)
 
index 54cce533b527bf4380eda4e304df5bf43573d63d..94f305cf9629929fab72dfc3c42c7318cc603687 100644 (file)
@@ -144,7 +144,7 @@ be sent, and the handler raises an exception. ::
 
    def handler(signum, frame):
        print 'Signal handler called with signal', signum
-       raise IOError, "Couldn't open device!"
+       raise IOError("Couldn't open device!")
 
    # Set the signal handler and a 5-second alarm
    signal.signal(signal.SIGALRM, handler)
index 430bb23fee8f089a8d1b610502e59635a4573431..d4eae5d1a49acdd4cdc6193129a9a80e7e596ebd 100644 (file)
@@ -157,10 +157,10 @@ Example::
                callback(pathname)
            else:
                # Unknown file type, print a message
-               print 'Skipping %s' % pathname
+               print('Skipping %s' % pathname)
 
    def visitfile(file):
-       print 'visiting', file
+       print('visiting', file)
 
    if __name__ == '__main__':
        walktree(sys.argv[1], visitfile)
index 9ce63d9b7ebb8695e40233efb607945a99305389..77a8411347efe593fdbe2b246019f16a757e0351 100644 (file)
@@ -1032,8 +1032,8 @@ formats in the string *must* include a parenthesised mapping key into that
 dictionary inserted immediately after the ``'%'`` character. The mapping key
 selects the value to be formatted from the mapping.  For example::
 
-   >>> print '%(language)s has %(#)03d quote types.' % \
-             {'language': "Python", "#": 2}
+   >>> print('%(language)s has %(#)03d quote types.' %
+             {'language': "Python", "#": 2})
    Python has 002 quote types.
 
 In this case no ``*`` specifiers may occur in a format (since they require a
@@ -1805,10 +1805,6 @@ types should support too):
    *default* is not given, it defaults to ``None``, so that this method never
    raises a :exc:`KeyError`.
 
-.. method:: dict.has_key(key)
-
-   ``d.has_key(key)`` is equivalent to ``key in d``, but deprecated.
-
 .. method:: dict.items()
 
    Return a copy of the dictionary's list of ``(key, value)`` pairs.
@@ -1923,7 +1919,7 @@ Files have the following methods:
 
       with open("hello.txt") as f:
           for line in f:
-              print line
+              print(line)
 
    In older versions of Python, you would have needed to do this to get the same
    effect::
@@ -1931,7 +1927,7 @@ Files have the following methods:
       f = open("hello.txt")
       try:
           for line in f:
-              print line
+              print(line)
       finally:
           f.close()
 
index 4736fc3a7c733986d3b76b9cf62f4b6bedfd489d..192e310532e1b2092358eafd354f412754be30d0 100644 (file)
@@ -45,7 +45,7 @@ Example usage::
 
    output = StringIO.StringIO()
    output.write('First line.\n')
-   print >>output, 'Second line.'
+   print('Second line.', file=output)
 
    # Retrieve file contents -- this will be
    # 'First line.\nSecond line.\n'
@@ -111,7 +111,7 @@ Example usage::
 
    output = cStringIO.StringIO()
    output.write('First line.\n')
-   print >>output, 'Second line.'
+   print('Second line.', file=output)
 
    # Retrieve file contents -- this will be
    # 'First line.\nSecond line.\n'
index dfd21a22a6bea68ccdb624ebfdda3f3ee5c7b7fc..5ac32df2df33f943cdd8375a3aea990ed2eb2f31 100644 (file)
@@ -284,11 +284,11 @@ A more realistic example would look like this::
    try:
        retcode = call("mycmd" + " myarg", shell=True)
        if retcode < 0:
-           print >>sys.stderr, "Child was terminated by signal", -retcode
+           print("Child was terminated by signal", -retcode, file=sys.stderr)
        else:
-           print >>sys.stderr, "Child returned", retcode
+           print("Child returned", retcode, file=sys.stderr)
    except OSError as e:
-       print >>sys.stderr, "Execution failed:", e
+       print("Execution failed:", e, file=sys.stderr)
 
 
 Replacing os.spawn\*
index dcd62a03003362dd698f3692d74872962312b376..4aabd8185fb542317504f5238dfaceace97b3a90 100644 (file)
@@ -601,13 +601,13 @@ How to read a gzip compressed tar archive and display some member information::
    import tarfile
    tar = tarfile.open("sample.tar.gz", "r:gz")
    for tarinfo in tar:
-       print tarinfo.name, "is", tarinfo.size, "bytes in size and is",
+       print(tarinfo.name, "is", tarinfo.size, "bytes in size and is", end="")
        if tarinfo.isreg():
-           print "a regular file."
+           print("a regular file.")
        elif tarinfo.isdir():
-           print "a directory."
+           print("a directory.")
        else:
-           print "something else."
+           print("something else.")
    tar.close()
 
 How to create a tar archive with faked information::
index c1f1260ff580c13c2555e401780220d1b7bbedfc..5cfca9a0ad2a64933f41435fc92b209494da3c4b 100644 (file)
@@ -234,5 +234,5 @@ A simple example illustrating typical use::
    tn.write("ls\n")
    tn.write("exit\n")
 
-   print tn.read_all()
+   print(tn.read_all())
 
index 305c26f45f82b78237c9c77af9c70a6ce833897a..1ba481022d069dd85be406cee81817dc29f2aa06 100644 (file)
@@ -307,7 +307,7 @@ The :mod:`test.test_support` module defines the following functions:
    Example use::
 
       with captured_stdout() as s:
-          print "hello"
+          print("hello")
       assert s.getvalue() == "hello"
 
 
index e4340fae8e749c9b9a2929c014e7494875931aa8..350354cd9e821c13e32533f171928818cfc86754 100644 (file)
@@ -64,8 +64,8 @@ indentation from strings that have unwanted whitespace to the left of the text.
           hello
             world
           '''
-          print repr(s)          # prints '    hello\n      world\n    '
-          print repr(dedent(s))  # prints 'hello\n  world\n'
+          print(repr(s))          # prints '    hello\n      world\n    '
+          print(repr(dedent(s)))  # prints 'hello\n  world\n'
 
 
 .. class:: TextWrapper(...)
index a2eeb8a0f930cd8492abc0af4741db78b814adb2..32437dcfba130b818b166dc8cb8a2da5faf7725d 100644 (file)
@@ -135,7 +135,7 @@ In addition to these methods, lock objects can also be used via the
    a_lock = thread.allocate_lock()
 
    with a_lock:
-       print "a_lock is locked while this executes"
+       print("a_lock is locked while this executes")
 
 **Caveats:**
 
index a676a1e4833ae929532fe61a379cccba02ef40de..828d42b6cb9c39cf60eba85b931fdc42c8e4c87a 100644 (file)
@@ -683,7 +683,7 @@ exactly the same as the interval specified by the user.
 For example::
 
    def hello():
-       print "hello, world"
+       print("hello, world")
 
    t = Timer(30.0, hello)
    t.start() # after 30 seconds, "hello, world" will be printed
@@ -721,5 +721,5 @@ Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`,
    some_rlock = threading.RLock()
 
    with some_rlock:
-       print "some_rlock is locked while this executes"
+       print("some_rlock is locked while this executes")
 
index bc9615af48d4f69d9565011267f710b19779ad72..3387c7f264d289f2dfe8835a0b5cc72938415d37 100644 (file)
@@ -196,13 +196,13 @@ attributes. ::
    ...     pass
    ... """
    >>> t = timeit.Timer(stmt=s)
-   >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
+   >>> print("%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000))
    17.09 usec/pass
    >>> s = """\
    ... if hasattr(str, '__bool__'): pass
    ... """
    >>> t = timeit.Timer(stmt=s)
-   >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
+   >>> print("%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000))
    4.85 usec/pass
    >>> s = """\
    ... try:
@@ -211,13 +211,13 @@ attributes. ::
    ...     pass
    ... """
    >>> t = timeit.Timer(stmt=s)
-   >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
+   >>> print("%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000))
    1.97 usec/pass
    >>> s = """\
    ... if hasattr(int, '__bool__'): pass
    ... """
    >>> t = timeit.Timer(stmt=s)
-   >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
+   >>> print("%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000))
    3.15 usec/pass
 
 To give the :mod:`timeit` module access to functions you define, you can pass a
@@ -225,12 +225,10 @@ To give the :mod:`timeit` module access to functions you define, you can pass a
 
    def test():
        "Stupid test function"
-       L = []
-       for i in range(100):
-           L.append(i)
+       L = [i for i in range(100)]
 
    if __name__=='__main__':
        from timeit import Timer
        t = Timer("test()", "from __main__ import test")
-       print t.timeit()
+       print(t.timeit())
 
index c7034ed7a4a2247bcb24c247aca1d56c9f2e3cfa..abe3ca5df23f2fba2e21a9b9483ab788e804b188 100644 (file)
@@ -505,7 +505,7 @@ Tix Commands
 
       import Tix
       root = Tix.Tk()
-      print root.tix_configure()
+      print(root.tix_configure())
 
 
 .. method:: tixCommand.tix_configure([cnf,] **kw)
index c4df6175648cf70900998d84a8e1e12ff2ac751a..f6c5c61a38f373847af5b0fcc21fd80d21e30cc2 100644 (file)
@@ -184,7 +184,7 @@ A Simple Hello World Program
 
    class Application(Frame):
        def say_hi(self):
-           print "hi there, everyone!"
+           print("hi there, everyone!")
 
        def createWidgets(self):
            self.QUIT = Button(self)
@@ -441,7 +441,7 @@ back will contain the name of the synonym and the "real" option (such as
 
 Example::
 
-   >>> print fred.config()
+   >>> print(fred.config())
    {'relief' : ('relief', 'relief', 'Relief', 'raised', 'groove')}
 
 Of course, the dictionary printed will include all the options available and
@@ -560,8 +560,8 @@ For example::
                                  self.print_contents)
 
        def print_contents(self, event):
-           print "hi. contents of entry is now ---->", \
-                 self.contents.get()
+           print("hi. contents of entry is now ---->",
+                 self.contents.get())
 
 
 The Window Manager
@@ -633,7 +633,7 @@ callback
    This is any Python function that takes no arguments.  For example::
 
       def print_it():
-              print "hi there"
+              print("hi there")
       fred["command"] = print_it
 
 color
index a9b15dbb5257dd0f7c4420921368b38173f2af3c..9b96743d3210112fa23b5b96b12d2dd45c0bd044 100644 (file)
@@ -147,12 +147,12 @@ module. ::
        try:
            exec(source, envdir)
        except:
-           print "Exception in user code:"
-           print '-'*60
+           print("Exception in user code:")
+           print("-"*60)
            traceback.print_exc(file=sys.stdout)
-           print '-'*60
+           print("-"*60)
 
    envdir = {}
-   while 1:
+   while True:
        run_user_code(envdir)
 
index 914351a411d5f98cecd927553bc4f317633435b8..3d28c45ce3727556313acf34fe645e3e6834e220 100644 (file)
@@ -438,14 +438,14 @@ containing parameters::
    >>> import urllib
    >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
    >>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
-   >>> print f.read()
+   >>> print(f.read())
 
 The following example uses the ``POST`` method instead::
 
    >>> import urllib
    >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
    >>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
-   >>> print f.read()
+   >>> print(f.read())
 
 The following example uses an explicitly specified HTTP proxy, overriding
 environment settings::
index 6360ab80fba74343175df5bb98adffa14f4c90da..b3e548558b4747088025575674c3dfbee187a048 100644 (file)
@@ -834,7 +834,7 @@ it::
 
    >>> import urllib2
    >>> f = urllib2.urlopen('http://www.python.org/')
-   >>> print f.read(100)
+   >>> print(f.read(100))
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <?xml-stylesheet href="./css/ht2html
 
@@ -846,7 +846,7 @@ installation supports SSL. ::
    >>> req = urllib2.Request(url='https://localhost/cgi-bin/test.cgi',
    ...                       data='This data is passed to stdin of the CGI')
    >>> f = urllib2.urlopen(req)
-   >>> print f.read()
+   >>> print(f.read())
    Got Data: "This data is passed to stdin of the CGI"
 
 The code for the sample CGI used in the above example is::
@@ -854,7 +854,7 @@ The code for the sample CGI used in the above example is::
    #!/usr/bin/env python
    import sys
    data = sys.stdin.read()
-   print 'Content-type: text-plain\n\nGot Data: "%s"' % data
+   print('Content-type: text-plain\n\nGot Data: "%s"' % data)
 
 Use of Basic HTTP Authentication::
 
index 44f8d9607b78887f980028377322e3b4189827a4..940e0646a2b7bca6427263e4ba4cd546beb5fa14 100644 (file)
@@ -236,7 +236,7 @@ If the referent no longer exists, calling the reference object returns
 :const:`None`::
 
    >>> del o, o2
-   >>> print r()
+   >>> print(r())
    None
 
 Testing that a weak reference object is still live should be done using the
@@ -247,9 +247,9 @@ a reference object should follow this pattern::
    o = r()
    if o is None:
        # referent has been garbage collected
-       print "Object has been deallocated; can't frobnicate."
+       print("Object has been deallocated; can't frobnicate.")
    else:
-       print "Object is still live!"
+       print("Object is still live!")
        o.do_something_useful()
 
 Using a separate test for "liveness" creates race conditions in threaded
index b3a3a9f53779db36f3524829f6929f345d7da32c..cf1fc977f1483b1b39270420c26a50399703453d 100644 (file)
@@ -244,7 +244,7 @@ request.  (E.g., using the :func:`shift_path_info` function from
       from wsgiref.simple_server import make_server, demo_app
 
       httpd = make_server('', 8000, demo_app)
-      print "Serving HTTP on port 8000..."
+      print("Serving HTTP on port 8000...")
 
       # Respond to requests until process is killed
       httpd.serve_forever()
index 6339a7fcea0f1b3e6a6dd9d70bea6c3a7accbfe1..e9d9367d209c4efbf089764302500589e949bcf1 100644 (file)
@@ -272,5 +272,5 @@ Here is an example of how you would catch one of these exceptions::
    try:
        p.pack_double(8.01)
    except xdrlib.ConversionError as instance:
-       print 'packing the double failed:', instance.msg
+       print('packing the double failed:', instance.msg)
 
index 0ad3b1743ba1bbdf0f35abd9c5d6a911727e0133..514332038237c5cbe2b8eb499ef72a4bb2291aba 100644 (file)
@@ -278,10 +278,10 @@ elements with no subelements will test as ``False``. ::
    element = root.find('foo')
 
    if not element: # careful!
-       print "element not found, or element has no subelements"
+       print("element not found, or element has no subelements")
 
    if element is None:
-       print "element not found"
+       print("element not found")
 
 
 .. _elementtree-elementtree-objects:
index 639b63f658061826cb35a45f7ed0b9c7527c231a..cd16348a3b6cf97bb39f510edea91271bc3206f4 100644 (file)
@@ -42,7 +42,7 @@ or as base classes.
    will be wrapped in double-quotes.  The resulting string can be used directly
    as an attribute value::
 
-      >>> print "<element attr=%s>" % quoteattr("ab ' cd \" ef")
+      >>> print("<element attr=%s>" % quoteattr("ab ' cd \" ef"))
       <element attr="ab ' cd &quot; ef">
 
    This function is useful when generating attribute values for HTML or any SGML
index d2ed771307f0982f79a8ee66c26e6f11f3e5bd5e..3b4dbbdf8d6d3cf7856dd85fb9ad70a5e0a13701 100644 (file)
@@ -371,12 +371,12 @@ Example of Client Usage
    # server = ServerProxy("http://localhost:8000") # local server
    server = ServerProxy("http://betty.userland.com")
 
-   print server
+   print(server)
 
    try:
-       print server.examples.getStateName(41)
+       print(server.examples.getStateName(41))
    except Error as v:
-       print "ERROR", v
+       print("ERROR", v)
 
 To access an XML-RPC server through a proxy, you need to define  a custom
 transport.  The following example,  written by NoboNobo, shows how:
@@ -404,5 +404,5 @@ transport.  The following example,  written by NoboNobo, shows how:
    p = ProxiedTransport()
    p.set_proxy('proxy-server:8080')
    server = xmlrpclib.Server('http://time.xmlrpc.com/RPC2', transport=p)
-   print server.currentTime.getCurrentTime()
+   print(server.currentTime.getCurrentTime())