Re: [Tutor] Instance into another instance

2005-02-20 Thread Kent Johnson
Ismael Garrido wrote: The idea of the class is to be able to create a tree. Where each node can have subnodes, which in turn can have their subnodes... Are you creating a tree to represent XML data? There are many packages available that do this. You might want to look at ElementTree which is

Re: Fwd: [Tutor] Create list of IPs

2005-02-20 Thread Kent Johnson
Liam Clarke wrote: Hi, you could save yourself some hassle and do minipstr = '1.0.0.1' maxipstr = '1.0.15.16' minip = map(int, minipstr.split('.')) maxip = map(int, maxipstr.split('.')) iplist = [] for a in range(minip[2], maxip[2]+1): ... if a maxip[2]: ... for b in

[Tutor] help with .get in Tkinter

2005-02-20 Thread Mark Kels
Hi all. First, here is the code I have a problem with (I got same problem in my project) : from Tkinter import * def go(): e.get() print e main=Tk() e=Entry(main) e.pack() b=Button(main,text='OK',command=go()).pack() main.mainloop() For some reason the function is called before I click

Re: Fwd: [Tutor] Create list of IPs

2005-02-20 Thread lumbricus
Liam Clarke wrote: [ snip ] - increment an IP. This is the hardest part. Why? An ip (V4) is just an 32bit integer :-) The problem arises from the representation. Use something like http://pynms.sourceforge.net/ipv4.html; to switch between the various representations. Kent HTH and

[Tutor] Re: Create list of IPs

2005-02-20 Thread Roel Schroeven
Ralfas Jegorovas wrote: I am wondering how I would go about making a list of IPs between two set IPs. # First, list2str can be written shorter .def list2str(lst): .return '.'.join(map(str, lst)) # The inverse of that is also needed .def str2list(s): .return map(int, s.split('.')) #

Re: [Tutor] help with .get in Tkinter

2005-02-20 Thread Michael Lange
On Sun, 20 Feb 2005 17:12:54 +0200 Mark Kels [EMAIL PROTECTED] wrote: Hi all. First, here is the code I have a problem with (I got same problem in my project) : from Tkinter import * def go(): e.get() print e main=Tk() e=Entry(main) e.pack()

Re: [Tutor] Instance into another instance

2005-02-20 Thread Kent Johnson
Ismael Garrido wrote: Kent Johnson wrote: Are you creating a tree to represent XML data? There are many packages available that do this. You might want to look at ElementTree which is one of the easiest to use. In fact, even if you aren't trying to represent XML you might find ElementTree

Re: [Tutor] Attaching an uploaded file to an email

2005-02-20 Thread Martin Walsh
Tim Wilson wrote: Hi everyone, Hi Tim, I'm a newb, first time posting, so please take any of the following advice at face value # Collect form information form = cgi.FieldStorage() requestername = form[requestername].value fromaddr = form[email].value itemname = form[itemname].value

[Tutor] Re: Create list of IPs

2005-02-20 Thread Ralfas Jegorovas
Thanks alot to everyone for your help! I'm not completely sure I understand how Roel's code works so I'll be doing a bit of research :-) (but it works :-D). Thanks again. All the best, Ralf ___ Tutor maillist - Tutor@python.org

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-20 Thread Liam Clarke
Ah, see, I should convince my bosses that I need a Python interpreter. Of course, then they'd ask what Python was, and why I was thinking about it at work Duh, I was just reading the docs, and I kept thinking that an attribute was just a class variable. Thanks, Kent, now I have all sorts of

Re: [Tutor] Attaching an uploaded file to an email

2005-02-20 Thread Liam Clarke
Yeah, you really have to see a few examples to get the hang of creating MIME emails, this is one area where I think the Python docs, quite frankly, stink. I had enough trouble getting attachments from a MIME email, let alone adding one. (But, if I recall correctly, a MIME email has a distinct

[Tutor] Re: Create list of IPs

2005-02-20 Thread Greg T
I am wondering how I would go about making a list of IPs between two set IPs. This is my initial code: my code def list2str(list): ip='' for part in list: if len(ip)!=0: ip=ip+'.'+part else: ip=ip+part return ip iplist = []