python中数学笛卡尔积生成
-*-coding:utf-8-*-
import itertools;
# a=[1,2,3];
# b=[4,5,6];
a = '不行;广大;大幅度;老;充分;大钱;大规模;特大;爸爸;俊雅;可怜;死;杀'.split(';')
b = '常温;超低温;高温;恒温;候温;炉温;气温;室温;水温;体温'.split(';')
print "a,b的笛卡尔乘积:",
for x in itertools.product(a,b):
print x[0], x[1]
print;
print "a自身的笛卡尔乘积:",
for x in itertools.product(a,a):
print x[0], x[1]