[Tutor] Importing a List from Module

Kent Johnson kent37 at tds.net
Sun Aug 28 06:15:15 CEST 2005


Tom Strickland wrote:
> I have a module called "enterData" which generates a list, "close" from 
> a data file. "close" is a list of floats. When I put a print statement 
> in that module it will print out an individual member of the list. For 
> example,
> 
>     print close[0]
> 
> 
> prints the first member of the list.
> 
> In my "main" module I import "enterData" and try to read the first 
> element of "close" as follows:
> 
>     import enterData
>     xy=enterData.close
>     print xy[0]   
> 
> 
> When I do this it prints out the entire "close" list, not just the first 
> term.
> 
> What's my mistake and how do I correct it?

What you have shown here looks fine to me. Can you show some more of enterData?

Kent



More information about the Tutor mailing list