[Tutor] Fw: Menu data from file

ALAN GAULD alan.gauld at btinternet.com
Mon Apr 5 00:29:50 CEST 2010


forwarding to the list.

Please use Reply All when replying to the 
list otherwise it is only a reply to the 
original poster.

 Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/



>
>----- Forwarded Message ----
>From: Neven Goršić <neven.gorsic at gmail.com>
>To: Alan Gauld <alan.gauld at btinternet.com>
>Sent: Sunday, 4 April, 2010 22:39:41
>Subject: Re: [Tutor] Menu data from file
>
>I can not loop over each list item like:
>
>                    for eachMenuData in self.menuData():
>
>because when I read external txt file:
>
>                    f=open(listFile,'r')
>                    lines=f.readlines()
>>                    f.close()
>
>I get the list of file lines instead of list of external list (tuple) 
>elements.
>And if I join that in one string (or use read() instead of readlines()) loop
>goes through every character, again not getting tuple/list elements....
>
>Neven
>
>---------------------------------------
>
>
>
>On Sun, Apr 4, 2010 at 7:05 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
>
>>>>"Neven Gorsic" <neven.gorsic at gmail.com> wrote
>>
>>
>>
>>>>>I would like to import menu data from external txt file, but not as import
>>>>>>menudata.py, because then py2exe makes problems ...
>>>>>>I would like to preserve list structure like:
>>>
>>
>>Yes that's a good idea.
>>
>>
>>
>>>>>   (("File",
>>>>>>      ("&New\tCtrl+N", "Create new blank script", self.onNew),
>>>>>>      ("&Open\tCtrl+O", "Opens call script", self.onOpen),
>>>>>>      ("","",""),
>>>>>>      ("&Save\tCtrl+S", "Saves call script", self.onSave),
>>>>>>                 .  .  .
>>>
>>>>>>Thanks,
>>>
>>
>>You're welcome.
>>
>>>>Or do you have a problem with implementing it?
>>>>If so what? What did you try? What happened?
>>>>Oh, and it will help to tell us which GUI toolkit
>>>>you are using too?
>>
>>
>>>>-- 
>>>>Alan Gauld
>>>>Author of the Learn to Program web site
>>http://www.alan-g.me.uk/ 
>>
>>>>_______________________________________________
>>>>Tutor maillist  -  Tutor at python.org
>>>>To unsubscribe or change subscription options:
>>http://mail.python.org/mailman/listinfo/tutor
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100404/6895b842/attachment.html>


More information about the Tutor mailing list