If you have already read the string into memory and want a convenient way to loop through it 3 characters at a time, check out the "batch" recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303279 It uses itertools to make an iterator over the string, returning 3 characters at a time. Cool stuff. nuttydevil wrote: > Hey everyone! I'm hoping someone will be able to help me, cause I > haven't had success searching on the web so far... I have large chunks > of text ( all in a long string) that are currently all in separate > notebook files. I want to use python to read these strings of text, > THREE CHARACTERS AT A TIME. (I'm studying the genetic code you see, so > I need to read and analyse each sequence one codon at a time > effectively.) Does anyone have any idea of how to do this using python? > > > I'm going to be optimistic and thank you for your help in advance! > Samantha. > -- http://mail.python.org/mailman/listinfo/python-list