Declaration of an array of unspecified size

Bertel Lund Hansen nospamius at lundhansen.dk
Sun Aug 31 16:29:50 CEST 2003


Hi all

I am relatively new to Python but have som programming
experience. I am experimenting wit a POP3-program and it's fairly
easy.

I want to read the mails into an array of lists so I later can
choose which one to display. But I need to declare an array of
unknown size before I can use it in the code. How do I manage
that?


class PopMailServer:
  host = ""
  user = ""
  password = "*"
  mails = 0
  mail[] # This is wrong but what do I do?

  def __init__ (self):
    pop=poplib.POP3(self.host)
    pop.user(self.user)
    pop.pass_(self.password)
    self.mails=len(pop.list()[1])
    for i in range(self.mails):
      self.mail[i]=pop.retr(i+1)[1] # This is also wrong.
    pop.quit()
    print "Antal mails: %d\n" % self.mails

-- 
Bertel
http://bertel.lundhansen.dk/	FIDUSO: http://fiduso.dk/




More information about the Python-list mailing list