mirror of
https://github.com/python/cpython.git
synced 2025-12-08 10:21:13 +00:00
String method conversion.
This commit is contained in:
parent
38151ed6b8
commit
1b645e8cd3
1 changed files with 5 additions and 5 deletions
|
|
@ -227,7 +227,7 @@ class SGMLParser:
|
||||||
return -1
|
return -1
|
||||||
tag, data = match.group(1, 2)
|
tag, data = match.group(1, 2)
|
||||||
self.__starttag_text = '<%s/' % tag
|
self.__starttag_text = '<%s/' % tag
|
||||||
tag = string.lower(tag)
|
tag = tag.lower()
|
||||||
k = match.end(0)
|
k = match.end(0)
|
||||||
self.finish_shorttag(tag, data)
|
self.finish_shorttag(tag, data)
|
||||||
self.__starttag_text = rawdata[start_pos:match.end(1) + 1]
|
self.__starttag_text = rawdata[start_pos:match.end(1) + 1]
|
||||||
|
|
@ -248,7 +248,7 @@ class SGMLParser:
|
||||||
if not match:
|
if not match:
|
||||||
raise RuntimeError, 'unexpected call to parse_starttag'
|
raise RuntimeError, 'unexpected call to parse_starttag'
|
||||||
k = match.end(0)
|
k = match.end(0)
|
||||||
tag = string.lower(rawdata[i+1:k])
|
tag = rawdata[i+1:k].lower()
|
||||||
self.lasttag = tag
|
self.lasttag = tag
|
||||||
while k < j:
|
while k < j:
|
||||||
match = attrfind.match(rawdata, k)
|
match = attrfind.match(rawdata, k)
|
||||||
|
|
@ -259,7 +259,7 @@ class SGMLParser:
|
||||||
elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
|
elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
|
||||||
attrvalue[:1] == '"' == attrvalue[-1:]:
|
attrvalue[:1] == '"' == attrvalue[-1:]:
|
||||||
attrvalue = attrvalue[1:-1]
|
attrvalue = attrvalue[1:-1]
|
||||||
attrs.append((string.lower(attrname), attrvalue))
|
attrs.append((attrname.lower(), attrvalue))
|
||||||
k = match.end(0)
|
k = match.end(0)
|
||||||
if rawdata[j] == '>':
|
if rawdata[j] == '>':
|
||||||
j = j+1
|
j = j+1
|
||||||
|
|
@ -274,7 +274,7 @@ class SGMLParser:
|
||||||
if not match:
|
if not match:
|
||||||
return -1
|
return -1
|
||||||
j = match.start(0)
|
j = match.start(0)
|
||||||
tag = string.lower(string.strip(rawdata[i+2:j]))
|
tag = rawdata[i+2:j].strip().lower()
|
||||||
if rawdata[j] == '>':
|
if rawdata[j] == '>':
|
||||||
j = j+1
|
j = j+1
|
||||||
self.finish_endtag(tag)
|
self.finish_endtag(tag)
|
||||||
|
|
@ -353,7 +353,7 @@ class SGMLParser:
|
||||||
# Example -- handle character reference, no need to override
|
# Example -- handle character reference, no need to override
|
||||||
def handle_charref(self, name):
|
def handle_charref(self, name):
|
||||||
try:
|
try:
|
||||||
n = string.atoi(name)
|
n = int(name)
|
||||||
except string.atoi_error:
|
except string.atoi_error:
|
||||||
self.unknown_charref(name)
|
self.unknown_charref(name)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue