refactor to auto import
This commit is contained in:
@@ -6,6 +6,8 @@ from re import sub
|
||||
import textwrap
|
||||
from html import escape
|
||||
from bs4 import BeautifulSoup
|
||||
import json
|
||||
from decimal import Decimal
|
||||
|
||||
# from lxml import etree
|
||||
import datetime
|
||||
@@ -29,6 +31,12 @@ for tag in tableTag:
|
||||
regTable = r'<(?P<slash>\/)*(?P<tag>'+strTable+')(?P<class>[^>]+)*>'
|
||||
regTableReplace = r'#[#\g<slash>\g<tag>\g<class>#]#'
|
||||
|
||||
class JSONEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, Decimal):
|
||||
return float(obj)
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
|
||||
def isNeedHtml(html):
|
||||
if "<TABLE" in html or "<table" in html or "</TR" in html or "</tr" in html :
|
||||
|
||||
Reference in New Issue
Block a user