]> granicus.if.org Git - python/commitdiff
String method conversion.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 9 Feb 2001 08:25:29 +0000 (08:25 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 9 Feb 2001 08:25:29 +0000 (08:25 +0000)
Lib/dis.py
Lib/htmllib.py
Lib/pstats.py

index 2dcecdb3bd26ffe1dfa66890c9f79a01e75f6614..dc3025721f2c81d4dec822818eb0a7c5f0af3d86 100644 (file)
@@ -1,7 +1,6 @@
 """Disassembler of Python byte code into mnemonics."""
 
 import sys
-import string
 import types
 
 __all__ = ["dis","disassemble","distb","disco","opname","cmp_op",
@@ -69,8 +68,8 @@ def disassemble(co, lasti=-1):
         else: print '   ',
         if i in labels: print '>>',
         else: print '  ',
-        print string.rjust(`i`, 4),
-        print string.ljust(opname[op], 20),
+        print `i`.rjust(4),
+        print opname[op].ljust(20),
         i = i+1
         if op >= HAVE_ARGUMENT:
             oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg
@@ -78,7 +77,7 @@ def disassemble(co, lasti=-1):
             i = i+2
             if op == EXTENDED_ARG:
                 extended_arg = oparg*65536L
-            print string.rjust(`oparg`, 5),
+            print `oparg`.rjust(5),
             if op in hasconst:
                 print '(' + `co.co_consts[oparg]` + ')',
             elif op in hasname:
index d3e8f88fecb70eb2869311afaa62548485d4e0e4..73af9f6734c09a47282ce6fe715df402da25209a 100644 (file)
@@ -5,7 +5,6 @@ http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html
 """
 
 
-import string
 from sgmllib import SGMLParser
 from formatter import AS_IS
 
@@ -50,7 +49,7 @@ class HTMLParser(SGMLParser):
         data = self.savedata
         self.savedata = None
         if not self.nofill:
-            data = string.join(string.split(data))
+            data = ' '.join(data.split())
         return data
 
     # --- Hooks for anchors; should probably be overridden
@@ -321,13 +320,13 @@ class HTMLParser(SGMLParser):
         name = ''
         type = ''
         for attrname, value in attrs:
-            value = string.strip(value)
+            value = value.strip()
             if attrname == 'href':
                 href = value
             if attrname == 'name':
                 name = value
             if attrname == 'type':
-                type = string.lower(value)
+                type = value.lower()
         self.anchor_bgn(href, name, type)
 
     def end_a(self):
@@ -362,10 +361,10 @@ class HTMLParser(SGMLParser):
             if attrname == 'src':
                 src = value
             if attrname == 'width':
-                try: width = string.atoi(value)
+                try: width = int(value)
                 except: pass
             if attrname == 'height':
-                try: height = string.atoi(value)
+                try: height = int(value)
                 except: pass
         self.handle_image(src, alt, ismap, align, width, height)
 
index 9923b95be025bea6aa853ef952d8e340906d76d0..764d89c95eabab9d0e722b892993895452015d01 100644 (file)
@@ -34,7 +34,6 @@
 
 import os
 import time
-import string
 import marshal
 import re
 
@@ -392,11 +391,11 @@ class Stats:
         return self
 
     def print_call_heading(self, name_size, column_title):
-        print string.ljust("Function ", name_size) + column_title
+        print "Function ".ljust(name_size) + column_title
 
 
     def print_call_line(self, name_size, source, call_dict):
-        print string.ljust(func_std_string(source), name_size),
+        print func_std_string(source).ljust(name_size),
         if not call_dict:
             print "--"
             return
@@ -414,11 +413,11 @@ class Stats:
 
 
     def print_title(self):
-        print string.rjust('ncalls', 9),
-        print string.rjust('tottime', 8),
-        print string.rjust('percall', 8),
-        print string.rjust('cumtime', 8),
-        print string.rjust('percall', 8),
+        print 'ncalls'.rjust(9),
+        print 'tottime'.rjust(8),
+        print 'percall'.rjust(8),
+        print 'cumtime'.rjust(8),
+        print 'percall'.rjust(8),
         print 'filename:lineno(function)'
 
 
@@ -427,7 +426,7 @@ class Stats:
         c = `nc`
         if nc != cc:
             c = c + '/' + `cc`
-        print string.rjust(c, 9),
+        print c.rjust(9),
         print f8(tt),
         if nc == 0:
             print ' '*8,
@@ -522,4 +521,4 @@ def count_calls(callers):
 #**************************************************************************
 
 def f8(x):
-    return string.rjust(fpformat.fix(x, 3), 8)
+    return fpformat.fix(x, 3).rjust(8)