summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/dis.py7
-rw-r--r--Lib/htmllib.py11
-rw-r--r--Lib/pstats.py19
3 files changed, 17 insertions, 20 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 2dcecdb..dc30257 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -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:
diff --git a/Lib/htmllib.py b/Lib/htmllib.py
index d3e8f88..73af9f6 100644
--- a/Lib/htmllib.py
+++ b/Lib/htmllib.py
@@ -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)
diff --git a/Lib/pstats.py b/Lib/pstats.py
index 9923b95..764d89c 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -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)