[Tutor] string object into reference
Pujo Aji
ajikoe at gmail.com
Tue Jan 17 22:08:20 CET 2006
Hello Kirk,
If I'm not mistaken your idea is referencing two columns: first column is
your acid name and the later is your surface area.
Later you want to connect the surface area if you name the acid name.
If that what you want another question arises... is your acid name is
unique.
If it is you can make dictionary types.
A csb
B dsk
C dsk
you can create
mydic = []
mydic['A'] = 'csb'
mydic['B'] = 'dsk'
mydic['C'] = 'dsk'
you have to transform the file into a list and after that start building the
dictionary variable.
After this dictionary variable is filled. you can get the surface area by
typing the acid name such as:
print mydic['A'] # will result 'csb'
Cheers,
pujo
On 1/17/06, Kirk Vander Meulen <kvander11 at gmail.com> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060117/00186bd8/attachment.html
More information about the Tutor
mailing list