擅长:python、mysql、java
<p>这正是你想要的</p>
<pre><code>string = "AAAATTTTATATATAT"
step = 2
split = [string[i:i+step] for i in range(0, len(string), step)]
print(",".join(split))
</code></pre>
<p><code>step</code>是要将字符串拆分成的块。最后一行将其与<code>,</code>连接起来,如您的示例所示,以提供最终输出<code>AA,AA,TT,TT,AT,AT,AT,AT</code></p>