import itertools
def cartesian_product_permutations(iterables):
"""
Computes the Cartesian product of the permutations of the given iterables.
Args:
iterables: A list of iterables.
Returns:
A list of tuples, where each tuple is a permutation of the elements of the given iterables.
"""
results = []
for permutation in itertools.permutations(*iterables):
results.append("".join(permutation))
return results
if __name__ == "__main__":
iterables = [["a", "b", "c"], ["x", "y", "z"]]
for permutation in cartesian_product_permutations(iterables):
print(permutation)
# Output:
# axz
# ayz
# azz
# bxz
# byz
# bzz
# cxz
# cyz
# czz
测试