You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
823 B
Python

import html5lib
with open("call.html") as fin:
t = html5lib.parse(fin, namespaceHTMLElements=False)
all_values = []
for select in t.findall(".//select"):
all_values.append([])
for value in select.findall(".//option"):
if value.text:
all_values[-1].append(value.text)
from pprint import pprint
# pprint(all_values)
# this goes on forever ;)
# import itertools
# count = 0
# all_combinations = []
# for p in itertools.product(*all_values):
# # print (p)
# all_combinations.append(p)
# count += 1
# if count == 100:
# break
# print (len(all_combinations))
from random import shuffle
# pprint(all_values)
# for i in range(10):
for i in range(3):
for values in all_values:
shuffle(values)
for p in zip(*all_values):
print (" ".join(p) + "?")