[Tutor] Importing a List from Module

Tom Strickland tlinux at comcast.net
Sun Aug 28 17:27:52 CEST 2005


Tom Strickland wrote:

> Eric,
>
> No, "xy" isn't used anywhere else in the program. It's just a dummy 
> variable I used to print out "enterData.close". I could easily have 
> left it out.
>
> Tom
>
>
> Eric Walker wrote:
>
>>I am a newbie but do you have anything else named xy
>>in your main module.
>>
>>Eric..
>>
>>--- Tom Strickland <tlinux at comcast.net> 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?
>>>
>>>Thank you!
>>>_______________________________________________
>>>Tutor maillist  -  Tutor at python.org
>>>http://mail.python.org/mailman/listinfo/tutor
>>>
>>>    
>>>
>>
>>
>>
>>		
>>__________________________________ 
>>Yahoo! Mail for Mobile 
>>Take Yahoo! Mail with you! Check email on your mobile phone. 
>>http://mobile.yahoo.com/learn/mail 
>>
>>
>>  
>>
>




More information about the Tutor mailing list