我的示例短代码是[abc-href]和[abc-title] 我这样想:
<a href="[abc-href]" title="[abc-title]">Link text here</a>
它没有被执行,任何人都可以回复原因吗?以及如何执行此操作。
提前致谢。
答案 0 :(得分:1)
from itertools import permutations
a = []
for i in range(4):
r = []
for j in range(3):
r.append(i+1)
a.append(r)
#print a # Uncomment to trace execution
all_paths = []
def gen_all_paths(matrix):
rows = len(matrix)
cols = len(matrix[0])
dj = rows - 1 # down-jumps
rj = cols - 1 # right-jumps
pathmix = 'd' * dj + 'r' * rj
prev = ()
for path in permutations(pathmix):
if path <= prev: # filter out repeats
continue
prev = path
r, c = 0, 0
cells = [matrix[0][0]]
for i in path:
if i == 'd':
r += 1
else:
c += 1
cells.append(matrix[r][c])
#print ''.join(path), cells # Uncomment to trace execution
all_paths.append(cells)
gen_all_paths(a)
print all_paths
试试这个。