wx.checklistbox

Fredrik Lundh fredrik at pythonware.com
Sat Apr 1 12:09:18 EST 2006


"luca72" wrote:

> i have again one simple problem:
>  the script is this:
>
>  def output(self):
>         global lista2
>         lista2 = open('/lista2', 'w')
>         iteminlista2 = self.checkListBox2.GetStrings()
>         lista2.writelines(iteminlista2)
>
>     def input1(self):
>         lista2leggi = open('/lista2', 'r')
>         cd = lista2leggi.readlines()
>         self.checkListBox2.AppendItems(cd)
>
> The write file is like:
>
> item1item2item3

writelines doesn't add newlines; you have to do that yourself.  try
using a plain loop instead:

    for item in iteminlista2:
        lista2.write(item + "\n")

</F>






More information about the Python-list mailing list