#bor = "TAAATATAATTTAATAGTATAAAAAAAATTAAATCAAATTAATAATAGTTTAAAAAACTGTTTGTATAATATAATATTATTATATATAATATTAAGCAACTACTATGATACTAATGAAGTATAGTGCTATTTTATTAATATGTAGCGTTAATTTATTTTGTTTTCAAAATAAATTAACTACTTCTCGATGGGAATTCCCTAAAGAAGATTTAATTAAAAAAAAAATAAAAATAGGCATAATTTACCATAATTACATAAATTCTATCTTTTACAATGAAAATTATAAATACATTGCCTTTATCGGAATATTGACATCTTATAATGAATGGATTGAAATACAATTTAGCCCCATAAATTTTTTTACTATCCCAACAAATAAAGATTTTATTTCAAATACTTATTTCAATTTAGCTTTCACTATTTACATTACCAAGTATTCAATTTTAACTGATACACTTGCTATAAAATTTTTTATTGGAACCCAAATCGATTTAACTCTGAGAACTACTATATTTACAGGAAAAACAACTCATGCATTTCTCTATCCAATTCTTCCCATAATTACCTTCAAATTTGAAATTGATTTCATACCTAATAACTATAGTATTTACTATAAATTATCGACTTCTTTTAAAGAATTTATCCTTTTAGATCTAGGAA" test ="MDRYFFLQDATTVAKLLLGNLLIRKIDKEEIVTRIVETEAYMGITDSACHSYGGKITNRTSAMYRIGGYSYVYIIYGMHYMFNVVTADKNNPQAVLIRSVEPISPLLGEKSILTNGPGKLTKFLNIDLTFNKVDLIGNNELFLQRGLNLDFNIVCSKRININYAQESDINKLWRFYIKDNKFVSRR" print test print len(test) #print bor #print len(bor) #def get_overlapped_substr(text_input, str_size, overlapsize): # return [ text_input[a:a+str_size] for a in range(0,len(text_input), str_size-overlapsize)], str_size, overlapsize STR_SIZE=30 OVERLAPSIZE = 10 ''' print range(0, len(test), STR_SIZE-OVERLAPSIZE) for i in range(0, len(test), STR_SIZE-OVERLAPSIZE): print test[i:i+STR_SIZE], i, "\t", len(test[i:i+STR_SIZE]),"\t[", i-(STR_SIZE-len(test[i:i+STR_SIZE])), "-", i-(STR_SIZE-len(test[i:i+STR_SIZE]))+STR_SIZE, "]" if (len(test[i:i+STR_SIZE]) < STR_SIZE): print test[i-(STR_SIZE-len(test[i:i+STR_SIZE])):i+STR_SIZE] break ''' print range(0, len(test), STR_SIZE-OVERLAPSIZE) for i in range(0, len(test), STR_SIZE-OVERLAPSIZE): string = test[i:i+STR_SIZE], i, len(test[i:i+STR_SIZE]),"["+ repr( i-(STR_SIZE-len(test[i:i+STR_SIZE])))+ "-"+ repr( i-(STR_SIZE-len(test[i:i+STR_SIZE]))+STR_SIZE) +"]" if (len(test[i:i+STR_SIZE]) < STR_SIZE): string = test[i-(STR_SIZE-len(test[i:i+STR_SIZE])):i+STR_SIZE] # print string break # print string print string
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question