[Tutor] string object into reference

Victor Bouffier victor at grupocdm.com
Tue Jan 17 23:38:48 CET 2006

Ooops. Did not respond to the mailing list.
Here is my replied-to post.
Hi Kirk,
There is nothing as a dumb question.

I am assuming your source file will have a amino acid residue ('CYS' or
'TRP'), followed by a space, and then the corresponding surface area.
You have to define a variable for adding the surface areas of each
residue type.

As you only have one of two options, the easiest way is to define a
variable for each (e.g. cys, trp) and then open the file and process
each line, adding the surface area to the corresponding amino acid.

As for reference, look for working with files (I/O), string variable
splitting (split function), and basic operations to add each new surface
Try writing some code and posting it back. Would be glad to review it.


On Tue, 2006-01-17 at 11:50 -0600, Kirk Vander Meulen wrote:
> Hi, just joined.  I've got a question that I'm guessing there's a
> ridiculously easy answer to, but I'm having trouble (no excuses, I'm
> just dumb!)...
> My problem is I want to make a string object into a reference to
> another object.  To be more specific, I'm reading through a text file
> of amino acids.  The first item on each line is the amino acid name,
> and a later item is its exposed surface area.  For each amino acid, I
> want to add up the surface area as I go through the text file.  So
> what I'm doing is, for each line, assigning the reference 'residue' to
> the amino acid name.  I'd like to then make the string referred to by
> 'residue' (eg, 'CYS' or 'TRP') a reference to an object that I will
> subsquently increment by the surface area value.
> Thanks for any help.  Perhaps I just need to be pointed to a relevent
> thread or given the correct words to search for in the archives or
> manual.
> Kirk
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list