现有 1.txt 文本文档,文档内有字符串,如下:
atggcgtttctgctttcattcggaactgaggtgcgggacgagctgcggcgcaactgggga
如何通过python代码(python2.7 等长梯度切割字符串
从第一个字符开始,每次移动一个字符,连续切分成长度为30的字符串,切分后的字符串集合如下,输出到 1qf.txt 文档内(输入输出通过文档进行是关键)
atggcgtttctgctttcattcggaactgag
tggcgtttctgctttcattcggaactgagg
ggcgtttctgctttcattcggaactgaggt
gcgtttctgctttcattcggaactgaggtg
cgtttctgctttcattcggaactgaggtgc
gtttctgctttcattcggaactgaggtgcg
tttctgctttcattcggaactgaggtgcgg
ttctgctttcattcggaactgaggtgcggg
tctgctttcattcggaactgaggtgcggga
ctgctttcattcggaactgaggtgcgggac
tgctttcattcggaactgaggtgcgggacg
gctttcattcggaactgaggtgcgggacga
ctttcattcggaactgaggtgcgggacgag
tttcattcggaactgaggtgcgggacgagc
ttcattcggaactgaggtgcgggacgagct
tcattcggaactgaggtgcgggacgagctg
cattcggaactgaggtgcgggacgagctgc
attcggaactgaggtgcgggacgagctgcg
ttcggaactgaggtgcgggacgagctgcgg
tcggaactgaggtgcgggacgagctgcggc
cggaactgaggtgcgggacgagctgcggcg
ggaactgaggtgcgggacgagctgcggcgc
gaactgaggtgcgggacgagctgcggcgca
aactgaggtgcgggacgagctgcggcgcaa
actgaggtgcgggacgagctgcggcgcaac
ctgaggtgcgggacgagctgcggcgcaact
tgaggtgcgggacgagctgcggcgcaactg
gaggtgcgggacgagctgcggcgcaactgg
aggtgcgggacgagctgcggcgcaactggg
ggtgcgggacgagctgcggcgcaactgggg
gtgcgggacgagctgcggcgcaactgggga