How to display name of elements in list?

Stefan Behnel stefan.behnel-n05pAM at web.de
Wed Jul 12 08:55:57 EDT 2006


Hi Claudio,

cz wrote:
>> Perhaps you need to rephrase your question.
>> --
>> Steven.
> 
> Thanks for your reply.
> OK, I'll try to make this more clear:
> My list called "elten" looks like that:
> 
> [Tensor: id = 1,  intensity = 2976.52
>  xx = -1447.32, xy = 52.458, xz = -594.186
>  yy = -1090.54, yz = -0.0158068, zz = -4043.
> , Tensor: id = 26,  intensity = 2896.9
>  ...
> , Tensor: id = 5,  intensity = 2920.5
>  xx = -1534.53, xy = 23.4858, xz = -623.967
>  yy = -1070.47, yz = 99.6301, zz = -3979.87
> ]
> 
> Now with
>>> print elten[1].id
> I will get "1" as an answer.
> Or with
>>> print elten[1].intensity
> it will print "2976.52".
> But this doesn't work for >>print elten[1].xx, why? So that's how I
> came to the question how to access these values. Any idea?

The list above is not a valid Python list. What is it that you store in that list?

Or is it maybe a dictionary?

Stefan



More information about the Python-list mailing list