Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
diff --git a/Demo/sockets/echosvr.py b/Demo/sockets/echosvr.py
index f8a9623..7de6391 100755
--- a/Demo/sockets/echosvr.py
+++ b/Demo/sockets/echosvr.py
@@ -21,7 +21,7 @@
     s.bind(('', port))
     s.listen(1)
     conn, (remotehost, remoteport) = s.accept()
-    print 'connected by', remotehost, remoteport
+    print('connected by', remotehost, remoteport)
     while 1:
         data = conn.recv(BUFSIZE)
         if not data:
diff --git a/Demo/sockets/ftp.py b/Demo/sockets/ftp.py
index eed45be..9f9f1dc 100755
--- a/Demo/sockets/ftp.py
+++ b/Demo/sockets/ftp.py
@@ -107,13 +107,13 @@
 def getreply(f):
     line = f.readline()
     if not line: return 'EOF'
-    print line,
+    print(line, end=' ')
     code = line[:3]
     if line[3:4] == '-':
         while 1:
             line = f.readline()
             if not line: break # Really an error
-            print line,
+            print(line, end=' ')
             if line[:3] == code and line[3:4] != '-': break
     return code
 
@@ -121,14 +121,14 @@
 # Get the data from the data connection.
 #
 def getdata(r):
-    print '(accepting data connection)'
+    print('(accepting data connection)')
     conn, host = r.accept()
-    print '(data connection accepted)'
+    print('(data connection accepted)')
     while 1:
         data = conn.recv(BUFSIZE)
         if not data: break
         sys.stdout.write(data)
-    print '(end of data connection)'
+    print('(end of data connection)')
 
 def raw_input(prompt):
     sys.stdout.write(prompt)
@@ -140,7 +140,7 @@
 def getcommand():
     try:
         while 1:
-            line = raw_input('ftp.py> ')
+            line = input('ftp.py> ')
             if line: return line
     except EOFError:
         return ''
diff --git a/Demo/sockets/gopher.py b/Demo/sockets/gopher.py
index 0635ac1..c287319 100755
--- a/Demo/sockets/gopher.py
+++ b/Demo/sockets/gopher.py
@@ -60,7 +60,7 @@
     while 1:
         line = f.readline()
         if not line:
-            print '(Unexpected EOF from server)'
+            print('(Unexpected EOF from server)')
             break
         if line[-2:] == CRLF:
             line = line[:-2]
@@ -69,15 +69,15 @@
         if line == '.':
             break
         if not line:
-            print '(Empty line from server)'
+            print('(Empty line from server)')
             continue
         typechar = line[0]
         parts = line[1:].split(TAB)
         if len(parts) < 4:
-            print '(Bad line from server: %r)' % (line,)
+            print('(Bad line from server: %r)' % (line,))
             continue
         if len(parts) > 4:
-            print '(Extra info from server: %r)' % (parts[4:],)
+            print('(Extra info from server: %r)' % (parts[4:],))
         parts.insert(0, typechar)
         list.append(parts)
     f.close()
@@ -95,7 +95,7 @@
     while 1:
         line = f.readline()
         if not line:
-            print '(Unexpected EOF from server)'
+            print('(Unexpected EOF from server)')
             break
         if line[-2:] == CRLF:
             line = line[:-2]
@@ -139,61 +139,61 @@
     if n > 2 and args[2]:
         port = args[2]
     if n > 3:
-        raise RuntimeError, 'too many args'
+        raise RuntimeError('too many args')
     try:
         browse_menu(selector, host, port)
     except socket.error as msg:
-        print 'Socket error:', msg
+        print('Socket error:', msg)
         sys.exit(1)
     except KeyboardInterrupt:
-        print '\n[Goodbye]'
+        print('\n[Goodbye]')
 
 # Browse a menu
 def browse_menu(selector, host, port):
     list = get_menu(selector, host, port)
     while 1:
-        print '----- MENU -----'
-        print 'Selector:', repr(selector)
-        print 'Host:', host, ' Port:', port
-        print
+        print('----- MENU -----')
+        print('Selector:', repr(selector))
+        print('Host:', host, ' Port:', port)
+        print()
         for i in range(len(list)):
             item = list[i]
             typechar, description = item[0], item[1]
-            print repr(i+1).rjust(3) + ':', description,
-            if typename.has_key(typechar):
-                print typename[typechar]
+            print(repr(i+1).rjust(3) + ':', description, end=' ')
+            if typechar in typename:
+                print(typename[typechar])
             else:
-                print '<TYPE=' + repr(typechar) + '>'
-        print
+                print('<TYPE=' + repr(typechar) + '>')
+        print()
         while 1:
             try:
-                str = raw_input('Choice [CR == up a level]: ')
+                str = input('Choice [CR == up a level]: ')
             except EOFError:
-                print
+                print()
                 return
             if not str:
                 return
             try:
                 choice = int(str)
             except ValueError:
-                print 'Choice must be a number; try again:'
+                print('Choice must be a number; try again:')
                 continue
             if not 0 < choice <= len(list):
-                print 'Choice out of range; try again:'
+                print('Choice out of range; try again:')
                 continue
             break
         item = list[choice-1]
         typechar = item[0]
         [i_selector, i_host, i_port] = item[2:5]
-        if typebrowser.has_key(typechar):
+        if typechar in typebrowser:
             browserfunc = typebrowser[typechar]
             try:
                 browserfunc(i_selector, i_host, i_port)
             except (IOError, socket.error):
                 t, v, tb = sys.exc_info()
-                print '***', t, ':', v
+                print('***', t, ':', v)
         else:
-            print 'Unsupported object type'
+            print('Unsupported object type')
 
 # Browse a text file
 def browse_textfile(selector, host, port):
@@ -203,7 +203,7 @@
         x = SaveLines(p)
         get_alt_textfile(selector, host, port, x.writeln)
     except IOError as msg:
-        print 'IOError:', msg
+        print('IOError:', msg)
     if x:
         x.close()
     f = open_savefile()
@@ -212,9 +212,9 @@
     x = SaveLines(f)
     try:
         get_alt_textfile(selector, host, port, x.writeln)
-        print 'Done.'
+        print('Done.')
     except IOError as msg:
-        print 'IOError:', msg
+        print('IOError:', msg)
     x.close()
 
 def raw_input(prompt):
@@ -225,32 +225,32 @@
 # Browse a search index
 def browse_search(selector, host, port):
     while 1:
-        print '----- SEARCH -----'
-        print 'Selector:', repr(selector)
-        print 'Host:', host, ' Port:', port
-        print
+        print('----- SEARCH -----')
+        print('Selector:', repr(selector))
+        print('Host:', host, ' Port:', port)
+        print()
         try:
-            query = raw_input('Query [CR == up a level]: ')
+            query = input('Query [CR == up a level]: ')
         except EOFError:
-            print
+            print()
             break
         query = query.strip()
         if not query:
             break
         if '\t' in query:
-            print 'Sorry, queries cannot contain tabs'
+            print('Sorry, queries cannot contain tabs')
             continue
         browse_menu(selector + TAB + query, host, port)
 
 # "Browse" telnet-based information, i.e. open a telnet session
 def browse_telnet(selector, host, port):
     if selector:
-        print 'Log in as', repr(selector)
+        print('Log in as', repr(selector))
     if type(port) != type(''):
         port = repr(port)
     sts = os.system('set -x; exec telnet ' + host + ' ' + port)
     if sts:
-        print 'Exit status:', sts
+        print('Exit status:', sts)
 
 # "Browse" a binary file, i.e. save it to a file
 def browse_binary(selector, host, port):
@@ -280,7 +280,7 @@
     def close(self):
         sts = self.f.close()
         if sts:
-            print 'Exit status:', sts
+            print('Exit status:', sts)
 
 # Class used to save data while showing progress
 class SaveWithProgress:
@@ -291,18 +291,18 @@
         sys.stdout.flush()
         self.f.write(data)
     def close(self):
-        print
+        print()
         sts = self.f.close()
         if sts:
-            print 'Exit status:', sts
+            print('Exit status:', sts)
 
 # Ask for and open a save file, or return None if not to save
 def open_savefile():
     try:
-        savefile = raw_input( \
+        savefile = input( \
     'Save as file [CR == don\'t save; |pipeline or ~user/... OK]: ')
     except EOFError:
-        print
+        print()
         return None
     savefile = savefile.strip()
     if not savefile:
@@ -312,24 +312,24 @@
         try:
             p = os.popen(cmd, 'w')
         except IOError as msg:
-            print repr(cmd), ':', msg
+            print(repr(cmd), ':', msg)
             return None
-        print 'Piping through', repr(cmd), '...'
+        print('Piping through', repr(cmd), '...')
         return p
     if savefile[0] == '~':
         savefile = os.path.expanduser(savefile)
     try:
         f = open(savefile, 'w')
     except IOError as msg:
-        print repr(savefile), ':', msg
+        print(repr(savefile), ':', msg)
         return None
-    print 'Saving to', repr(savefile), '...'
+    print('Saving to', repr(savefile), '...')
     return f
 
 # Test program
 def test():
     if sys.argv[4:]:
-        print 'usage: gopher [ [selector] host [port] ]'
+        print('usage: gopher [ [selector] host [port] ]')
         sys.exit(2)
     elif sys.argv[3:]:
         browser(sys.argv[1], sys.argv[2], sys.argv[3])
diff --git a/Demo/sockets/mcast.py b/Demo/sockets/mcast.py
index 1abd305..c1902d6 100755
--- a/Demo/sockets/mcast.py
+++ b/Demo/sockets/mcast.py
@@ -52,7 +52,7 @@
     while 1:
         data, sender = s.recvfrom(1500)
         while data[-1:] == '\0': data = data[:-1] # Strip trailing \0's
-        print sender, ':', repr(data)
+        print(sender, ':', repr(data))
 
 
 # Open a UDP socket, bind it to a port and select a multicast group
@@ -76,7 +76,7 @@
     group = gethostbyname(group)
     #
     # Construct binary group address
-    bytes = map(int, string.split(group, "."))
+    bytes = list(map(int, string.split(group, ".")))
     grpaddr = 0
     for byte in bytes: grpaddr = (grpaddr << 8) | byte
     #
diff --git a/Demo/sockets/rpython.py b/Demo/sockets/rpython.py
index 8333d39..b654dc2 100755
--- a/Demo/sockets/rpython.py
+++ b/Demo/sockets/rpython.py
@@ -12,7 +12,7 @@
 
 def main():
     if len(sys.argv) < 3:
-        print "usage: rpython host command"
+        print("usage: rpython host command")
         sys.exit(2)
     host = sys.argv[1]
     port = PORT
@@ -30,6 +30,6 @@
         data = s.recv(BUFSIZE)
         if not data: break
         reply = reply + data
-    print reply,
+    print(reply, end=' ')
 
 main()
diff --git a/Demo/sockets/rpythond.py b/Demo/sockets/rpythond.py
index 34de982..d745cc7 100755
--- a/Demo/sockets/rpythond.py
+++ b/Demo/sockets/rpythond.py
@@ -7,7 +7,7 @@
 
 import sys
 from socket import *
-import StringIO
+import io
 import traceback
 
 PORT = 4127
@@ -23,7 +23,7 @@
     s.listen(1)
     while 1:
         conn, (remotehost, remoteport) = s.accept()
-        print 'connected by', remotehost, remoteport
+        print('connected by', remotehost, remoteport)
         request = ''
         while 1:
             data = conn.recv(BUFSIZE)
@@ -37,12 +37,12 @@
 def execute(request):
     stdout = sys.stdout
     stderr = sys.stderr
-    sys.stdout = sys.stderr = fakefile = StringIO.StringIO()
+    sys.stdout = sys.stderr = fakefile = io.StringIO()
     try:
         try:
             exec(request, {}, {})
         except:
-            print
+            print()
             traceback.print_exc(100)
     finally:
         sys.stderr = stderr
diff --git a/Demo/sockets/telnet.py b/Demo/sockets/telnet.py
index 6bc9bcc..038036ff 100755
--- a/Demo/sockets/telnet.py
+++ b/Demo/sockets/telnet.py
@@ -77,7 +77,7 @@
             cleandata = ''
             for c in data:
                 if opt:
-                    print ord(c)
+                    print(ord(c))
                     s.send(opt + c)
                     opt = ''
                 elif iac:
@@ -85,18 +85,18 @@
                     if c == IAC:
                         cleandata = cleandata + c
                     elif c in (DO, DONT):
-                        if c == DO: print '(DO)',
-                        else: print '(DONT)',
+                        if c == DO: print('(DO)', end=' ')
+                        else: print('(DONT)', end=' ')
                         opt = IAC + WONT
                     elif c in (WILL, WONT):
-                        if c == WILL: print '(WILL)',
-                        else: print '(WONT)',
+                        if c == WILL: print('(WILL)', end=' ')
+                        else: print('(WONT)', end=' ')
                         opt = IAC + DONT
                     else:
-                        print '(command)', ord(c)
+                        print('(command)', ord(c))
                 elif c == IAC:
                     iac = 1
-                    print '(IAC)',
+                    print('(IAC)', end=' ')
                 else:
                     cleandata = cleandata + c
             sys.stdout.write(cleandata)
diff --git a/Demo/sockets/throughput.py b/Demo/sockets/throughput.py
index b8df1f3..64244aa 100755
--- a/Demo/sockets/throughput.py
+++ b/Demo/sockets/throughput.py
@@ -33,8 +33,8 @@
 
 def usage():
     sys.stdout = sys.stderr
-    print 'Usage:    (on host_A) throughput -s [port]'
-    print 'and then: (on host_B) throughput -c count host_A [port]'
+    print('Usage:    (on host_A) throughput -s [port]')
+    print('and then: (on host_B) throughput -c count host_A [port]')
     sys.exit(2)
 
 
@@ -46,7 +46,7 @@
     s = socket(AF_INET, SOCK_STREAM)
     s.bind(('', port))
     s.listen(1)
-    print 'Server ready...'
+    print('Server ready...')
     while 1:
         conn, (host, remoteport) = s.accept()
         while 1:
@@ -56,7 +56,7 @@
             del data
         conn.send('OK\n')
         conn.close()
-        print 'Done with', host, 'port', remoteport
+        print('Done with', host, 'port', remoteport)
 
 
 def client():
@@ -82,12 +82,12 @@
     t4 = time.time()
     data = s.recv(BUFSIZE)
     t5 = time.time()
-    print data
-    print 'Raw timers:', t1, t2, t3, t4, t5
-    print 'Intervals:', t2-t1, t3-t2, t4-t3, t5-t4
-    print 'Total:', t5-t1
-    print 'Throughput:', round((BUFSIZE*count*0.001) / (t5-t1), 3),
-    print 'K/sec.'
+    print(data)
+    print('Raw timers:', t1, t2, t3, t4, t5)
+    print('Intervals:', t2-t1, t3-t2, t4-t3, t5-t4)
+    print('Total:', t5-t1)
+    print('Throughput:', round((BUFSIZE*count*0.001) / (t5-t1), 3), end=' ')
+    print('K/sec.')
 
 
 main()
diff --git a/Demo/sockets/udpecho.py b/Demo/sockets/udpecho.py
index 5181c82..8a6bd21 100755
--- a/Demo/sockets/udpecho.py
+++ b/Demo/sockets/udpecho.py
@@ -23,8 +23,8 @@
 
 def usage():
     sys.stdout = sys.stderr
-    print 'Usage: udpecho -s [port]            (server)'
-    print 'or:    udpecho -c host [port] <file (client)'
+    print('Usage: udpecho -s [port]            (server)')
+    print('or:    udpecho -c host [port] <file (client)')
     sys.exit(2)
 
 def server():
@@ -34,10 +34,10 @@
         port = ECHO_PORT
     s = socket(AF_INET, SOCK_DGRAM)
     s.bind(('', port))
-    print 'udp echo server ready'
+    print('udp echo server ready')
     while 1:
         data, addr = s.recvfrom(BUFSIZE)
-        print 'server received %r from %r' % (data, addr)
+        print('server received %r from %r' % (data, addr))
         s.sendto(data, addr)
 
 def client():
@@ -51,13 +51,13 @@
     addr = host, port
     s = socket(AF_INET, SOCK_DGRAM)
     s.bind(('', 0))
-    print 'udp echo client ready, reading stdin'
+    print('udp echo client ready, reading stdin')
     while 1:
         line = sys.stdin.readline()
         if not line:
             break
         s.sendto(line, addr)
         data, fromaddr = s.recvfrom(BUFSIZE)
-        print 'client received %r from %r' % (data, fromaddr)
+        print('client received %r from %r' % (data, fromaddr))
 
 main()
diff --git a/Demo/sockets/unixclient.py b/Demo/sockets/unixclient.py
index fdbcc7a..cdccb84 100644
--- a/Demo/sockets/unixclient.py
+++ b/Demo/sockets/unixclient.py
@@ -9,4 +9,4 @@
 s.send('Hello, world')
 data = s.recv(1024)
 s.close()
-print 'Received', repr(data)
+print('Received', repr(data))
diff --git a/Demo/sockets/unixserver.py b/Demo/sockets/unixserver.py
index b73f857..c3c9c4f 100644
--- a/Demo/sockets/unixserver.py
+++ b/Demo/sockets/unixserver.py
@@ -8,7 +8,7 @@
 s = socket(AF_UNIX, SOCK_STREAM)
 s.bind(FILE)
 
-print 'Sock name is: ['+s.getsockname()+']'
+print('Sock name is: ['+s.getsockname()+']')
 
 # Wait for a connection
 s.listen(1)