[Tutor] Importing a List from Module

Tom Strickland tlinux at comcast.net
Sun Aug 28 05:27:23 CEST 2005


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?

Thank you!


More information about the Tutor mailing list