tools/web: simplify regexp and typo
This commit is contained in:
parent
56c43179f3
commit
5141a0dc17
@ -203,7 +203,7 @@ def striphtml(data):
|
|||||||
data -- the string to strip
|
data -- the string to strip
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not isinstance(data, str) and not isinstance(data, buffer):
|
if not isinstance(data, str) and not isinstance(data, bytes):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -232,6 +232,5 @@ def striphtml(data):
|
|||||||
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
r, _ = re.subn(r' +', ' ',
|
return re.sub(r' +', ' ',
|
||||||
unescape(re.sub(r'<.*?>', '', data)).replace('\n', ' '))
|
unescape(re.sub(r'<.*?>', '', data)).replace('\n', ' '))
|
||||||
return r
|
|
||||||
|
Loading…
Reference in New Issue
Block a user