A common Javascript pattern is to directly insert elements into the DOM. To this effect, you will encounter many instances where an "improperly " coded script element (as in without using CDATA, a rare habit and one that I'm completely against) will cause the parser to grind to a screeching halt. The fix is simple, apply the following filter to your source string:
Code:
import re
re_script = re.compile("<script.*?>((?:.|\s)+?)</script>")
I'm not quite sure if you still need this still, but the basic gist would be something like
Code:
if __name__ == "__main__":
grid = []
from random import randint
SIZE = 9
MINI = 3
HARD = int(float(SIZE)*1.5)
MEDIUM = SIZE*2+2
EASY = SIZE*3
for i in range(SIZE):
_grid = []
Leave a comment: