Re: [Tutor] Checking the format of IP address...

2006-11-03 Thread Guillermo Fernandez Castellanos
Hi, I would probably take the string, separate the numbers and check they are acceptable: def correct_ip(ip): # Check if my IP address has 4 numbers separated by dots num=ip.split('.') if not len(num)==4: return False # Check each of the 4 numbers is between 0 and 255 for n

Re: [Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]

2006-01-08 Thread Guillermo Fernandez Castellanos
Hi, Look at this: >>> i=[1,2,3] >>> i[len(i)] Traceback (most recent call last): File "", line 1, in ? IndexError: list index out of range This means that I have tried to access an element that is out of the list, in this case i[3], that is, the 4th element of the list. You are doing the

[Tutor] [OT] Python Tutor like java mailing list

2005-12-30 Thread Guillermo Fernandez Castellanos
Hi, After python I have to start learning Java. Do you know of any Tutor-like list for Java you could recommend? I've been looking and I've been unable to find any... and i miss it :-) Thanks, Guille ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] threads

2005-02-23 Thread guillermo . fernandez . castellanos
Nothing to do, but did you think about SimPy? http://simpy.sourceforge.net/ It may make your life much simpler. G On Wed, 23 Feb 2005 11:32:12 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Wed, 23 Feb 2005, Shitiz Bansal wrote: > > > I am trying to build a traffic network simulator us

Re: [Tutor] Traffic Network simulator

2005-01-31 Thread Guillermo Fernandez Castellanos
Hi, Don't know if there's any network simulator. But I know about SimPy: http://simpy.sourceforge.net/ Looks well documented. Check the examples, it seems you can do pretty robust things with not toomuch code. I readed about it in the charming python section of IBM developers works: http://www-1

Re: [Tutor] Combination

2005-01-23 Thread Guillermo Fernandez Castellanos
Got it. import copy def rec(list,length): result=[] if len(list)<=length: return [list] for elem in list: temp=copy.deepcopy(list) temp.remove(elem) temp=rec(temp,length) for i in temp:

[Tutor] Combination

2005-01-21 Thread Guillermo Fernandez Castellanos
Hi, I'm trying to take a list and find all the unique combinations of that list. I mean: if I enter (1,2,3,4,5) and I watn combinations of 3, I want to find: (1,2,3) but then not (2,1,3), (3,1,2),... (1,2,4) (1,2,5) (2,3,5) (3,4,5) The thing is, I want to do it as a generic function, where I pas

Re: [Tutor] py2exe

2005-01-18 Thread Guillermo Fernandez Castellanos
Hi, > Does ExFileSelectDialog do anything that the standard Tk file dialogs don't? > (if you don't know about it: have a look at the tkFileDialog module) (*Ashamed*) Indeed not. Well... tkFileDialog is a bit more "bulky" that ExFileSelectDialot, but the functionalities are alike. Actually, my Tk

Re: [Tutor] py2exe

2005-01-18 Thread Guillermo Fernandez Castellanos
Hi, > When I tried, I couldn't figure out how to freeze Tix. I ended up giving up > and > recoding all my Tix stuff to use Pmw instead... > (although I was a lot more new to python in those days) Indeed, I think I'm going to do the same. I find the situation really surprising though. When I go t

Re: [Tutor] py2exe

2005-01-16 Thread Guillermo Fernandez Castellanos
5 23:12:26 -0800 (PST), Chad Crabtree <[EMAIL PROTECTED]> wrote: > Try something like. > import mx > import Tix > > Sometimes py2exe will not gather up all the modules that it depends > on. > It does an admirable job but still needs some help. Perhaps you are > in

[Tutor] py2exe

2005-01-16 Thread Guillermo Fernandez Castellanos
Hi, I've done a GUI program and it works perfectly. but when I try to package it with py2exe, I obtain the following result: The following modules appear to be missing ['mx'] And when i run it, it crashes with this error message: Traceback (most recent call last): File "openwar.py", line 41, i

Re: [Tutor] Tix and Table printing

2005-01-13 Thread Guillermo Fernandez Castellanos
wrote: > > > On Thu, 13 Jan 2005, Guillermo Fernandez Castellanos wrote: > > > Is there any "table" frame that I am unaware of? > > > Hi Guillermo, > > There are some recipes for making a Tkinter table widget; here's one: > > http

Re: [Tutor] Re: Is Tkinter the Gui in python

2005-01-13 Thread Guillermo Fernandez Castellanos
> > So tkinter is a good module to use if you only want simple widgets, > > but be prepared to switch to something newer when you hit it's > limitations. > This I agree with totally, fortunately I've yet to hit itslimitations > in my fairly simple GUIs. Well... there's also Tix... but I don't know

[Tutor] Tix and Table printing

2005-01-13 Thread Guillermo Fernandez Castellanos
Hi, I have a table of information that look like this (only 3 lines here): Gibraltar Division BR INF D 095 59 GAR None 10-7-4-6 Gibraltar Kuwait Division BR INF D 148 71GAR None 2-1-0-4 Kuwait Somaliland Division BR INF D 139 84 GAR None 2-1-0-3 None I would like to show this in a nice

Re: [Tutor] More and more OT - Python/Java

2005-01-12 Thread Guillermo Fernandez Castellanos
> 1500 entries shouldn't be a problem for queries either using DOM > (in memory) or XPath or even XQuery. If your app grows to 15 > it might stat to be a problem, and if you get over a million > entries I'd definitely start thinking about regular RDBMS. Hi, No it will not go further... let's s

Re: [Tutor] More and more OT - Python/Java

2005-01-11 Thread Guillermo Fernandez Castellanos
Hi, Just out of curiosity, > > Well, I plan to use it as a data storage format for a university > > project (crowd simulation in a shopping center -- coded in Java). I > > hate binary data formats, and XML is a good unified way to store data > > as ASCII text, so I figured I'd use it. > >

Re: [Tutor] Soem list operation questions?

2004-12-27 Thread Guillermo Fernandez Castellanos
hi! > 1. Is there any easy way to compeltely reverse a list so that the last index > becomes the first, etc.? The doc is your friend :-) http://www.python.org/dev/doc/maint24/lib/typesseq-mutable.html """s.reverse() reverses the items of s in place""" >>> a=[1,2,3,4] >>> a.reverse() >>>

Re: [Tutor] Re: Tix Select programming problem

2004-12-27 Thread Guillermo Fernandez Castellanos
On Wed, 22 Dec 2004 11:37:57 +0900 > Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote: > Hi Guille, > The "command" option should be assigned to the Select widget itself, not to > the added buttons. > It takes two arguments then (from the tixSelect man

Re: [Tutor] O.T.

2004-12-27 Thread Guillermo Fernandez Castellanos
Hi, 26 years, single, spanish but having lived around Europe, communication systems engineer, working in Japan now for a year, going back to europe in April and looking for a job. I've done mainly network stuff, from system conception to network programming in C. I've worked in VoIP (SIP, Megaco,

Tix Select programming problem + Re: [Tutor] Tix NoteBook programming problem

2004-12-21 Thread Guillermo Fernandez Castellanos
its value""" http://tix.sourceforge.net/dist/current/docs/tix-book/intro.tex.html#1-11 Thanks, G On Tue, 21 Dec 2004 21:28:40 +0100, Michael Lange <[EMAIL PROTECTED]> wrote: > On Tue, 21 Dec 2004 14:16:56 +0900 > Guillermo Fernandez Castellanos <[EMAIL PROTECTED]>

[Tutor] Tix NoteBook programming problem

2004-12-20 Thread Guillermo Fernandez Castellanos
Hi, I'm trying to figure out how to work with Tix. The lack of examples and avalaibility of documentation for TCL only do not help :-( It does not work because when I start the program, the red and gren buttons start blinking betweeb 2 or 3 different places, no matter what the tab is. Here is th

Re: [Tutor] Capturing Logfile data in Windows

2004-12-09 Thread Guillermo Fernandez Castellanos
Hi, If you want an easy way of iterating over stdin, you may be interested in using this module: http://www.python.org/dev/doc/devel/lib/module-fileinput.html I've used it with some of my scripts to do something similar. It will not work for a growing file though... Otherwise, you can always tr

Re: [Tutor] Vpython

2004-12-08 Thread Guillermo Fernandez Castellanos
Hi, On the Vpython homepage they have links to quite a few programs: http://vpython.org/contributed.html http://www.physics.syr.edu/%7Esalgado/software/vpython/ Should be enough for a start. Enjoy, Guille On Wed, 8 Dec 2004 22:05:31 -0500 (GMT-05:00), [EMAIL PROTECTED] <[EMAIL PROTECTED]> wro

Re: [Tutor] about recursion code

2004-12-06 Thread Guillermo Fernandez Castellanos
Usually, in case of doubt, use a debugger or print statements: def selection_sort(lst,start,end): """sort the lst from selection start to end""" print lst, start, end if len(lst)==1: print "list of size 1" return lst elif lst=="":

[Tutor] unittest.makeSuite question

2004-12-02 Thread Guillermo Fernandez Castellanos
Hi, I've been through the unittest tutorial page and I've seen this function: suite = unittest.makeSuite(Testname,'test') In the python 2.4 Python Library Reference I have find no reference to such a fucntion (there is an example, exactly the same but without the 'test' parameter). I could not r