擅长:python、mysql、java
<p>您可以使用<a href="http://docs.python.org/library/stdtypes.html#str.join" rel="nofollow">join string method</a>:</p>
<pre><code>>>> import itertools
>>> p = list( itertools.product( ['a','b','c' ],['e','f','g'] ) )
>>> p
[('a', 'e'), ('a', 'f'), ('a', 'g'), ('b', 'e'), ('b', 'f'), ('b', 'g'), ('c', 'e'), ('c', 'f'), ('c', 'g')]
>>> ', '.join( a+b for (a,b) in p )
'ae, af, ag, be, bf, bg, ce, cf, cg'
</code></pre>