Processing text using python

John Zenger john_zenger at yahoo.com
Mon Feb 20 12:11:09 EST 2006


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.
> 



More information about the Python-list mailing list